I would like to configure the use of the maven source plugin for all our projects. The way our projects are currently configured we have a parent pom that is inherited by all the projects. So, in order for all projects to use the maven source plugin, I did the following:
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>
Could someone please tell me if this is the best way to configure this? Is there any way you can avoid specifying the source plugin in the child pom?