我有两个maven-dependency-plugin配置,一个在我的父模块中,另一个在我的子模块中。父执行不仅仅运行子进程。如果我手动复制(不移动)父执行到子插件执行它可以工作,但我不想这样做,因为我还需要其他项目/子/模块的父配置。如果我注释掉子插件执行,它会运行父执行。
我的子插件执行基于答案here
Child pom config(无论如何总是运行):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-model</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>my.test.pkg</groupId>
<artifactId>my-model</artifactId>
<classifier>server</classifier>
<version>1.0.3</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
父配置(仅在子pom中重复时运行):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>build-classpath</id>
<phase>generate-sources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputFilterFile>true</outputFileterFile>
<includeScope/>
<fileSeparator/>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
答案 0 :(得分:0)
PluginManagement在父pom.xml中同时具有插件版本和插件配置,这禁止在您继承子pom时在父级中执行。
从pluginManagement中删除了配置/执行,并修复了它。