我希望为我们所有的项目配置maven source plugin。目前,我们的项目都是继承一个parent pom。因此,为了让所有项目都使用maven source plugin,我采取了以下措施:
Defined the maven source plugin under
build -> plugin management
in the parent pom<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin>
In my project pom (the child pom), I have included the source plugin under
build -> plugins
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
请问这是配置的最佳方式吗?有没有办法避免在子POM中指定源插件?
build -> plugins
部分中,而不是build -> pluginManagement
。 - Andrew Logvinov