这是我的 pom 文件的片段。
....
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
......
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
我通过命令成功使用它
mvn install
但是,当我尝试将其包含到“pluginManagement”标记中时,当我启动 install
目标时,maven-dependency-plugin
停止工作。
为什么“pluginManagement”标签会改变构建行为?或者我应该使用另一个目标或选择?
最佳答案
您还需要添加
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
在您的构建中,因为 pluginManagement
只是在所有项目模块之间共享相同插件配置的一种方式。
来自 Maven 文档:
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one. However, this only configures plugins that are actually referenced within the plugins element in the children. The children have every right to override pluginManagement definitions.
关于java - Maven的pom.xml中的pluginManagement是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40159872/