Maven 的 Scope

scope

  1. compile (v. 编译): 全流程都在;

  2. test: junit, 只出现在测试中;

  3. provided: servlet_api, 出现在编译时需要, 运行时用别人的 (容器已经有了), 不打进 war 包, 最终都有包用;

  4. runtime: jdbc, devtools, 会打进 war 包, 与compile类似, 与 provide 区别主要如下:

能否 import 出现在 war 包中
compile 1 1
runtime 1
provide 1

插件

我们执行的是lifecycle

maven一个个 lifecycle 是通过执行 phase 触发 goal 来实现的;

goal 执行绑定的对应插件

每一个 phase 绑定了一个或多个 goal

默认自带的就绑定了几个插件, 无需引用

Goal

执行的Phase 对应执行的Goal
compile compiler:compile
test compiler:testCompile
surefire:test

compiler:compile 就叫 goal
在这里插入图片描述

lifecycle相当于Java的package,它包含一个或多个phase;
phase相当于Java的class,它包含一个或多个goal;
goal相当于class的method,它其实才是真正干活的。

在这里插入图片描述

SpringBoot 打包插件会把自己绑在 package 这一步了,Maven 执行到 package 这一步就会自动调用这个插件;

猜你喜欢

转载自blog.csdn.net/howeres/article/details/114984892