来自maven 文档
pluginManagement:是一个沿侧插件看到的元素.插件管理以大致相同的方式包含插件元素,除了不是为这个特定的项目构建配置插件信息,它旨在配置从这个继承的项目构建.但是,这仅配置在子节点的plugins元素中实际引用的插件.孩子们有权重写pluginManagement定义.
现在:如果我在父POM中有这个
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<executions>
Some stuff for the children
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
我在父项目上运行mvn help:effective-pom我得到了我想要的东西,即直接在构建下的插件部分(做工作的那个)仍然是空的.
现在,如果我执行以下操作:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<executions>
Some stuff for the children
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
mvn help:effective-pom我再次得到我想要的东西,插件包含声明的内容,并且忽略了pluginManagement部分.
但改变如下
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<executions>
Some stuff for the children
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
<inherited>false</inherited> <!-- …Run Code Online (Sandbox Code Playgroud) 我们都知道依赖树对于解决传递依赖冲突至关重要.同样的情况也是如此dependencyManagement,但我找不到以类似的方式为它打印依赖关系树的方法dependencies.
是否有插件或其他可以帮助的东西?
Maven版本:3.2.3
编辑
对于认为此问题与其他问题重复的人,请考虑:
另一个问题是关于依赖管理的插件管理.
另一个问题没有说明生成依赖树.