Is it possible to avoid duplicating the maven archive configuration?

This is my pom.xml parent:

 [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0</version> <configuration> <archive> <manifestEntries> <SCM-Revision>${buildNumber}</SCM-Revision> </manifestEntries> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.0</version> <configuration> <archive> <manifestEntries> <SCM-Revision>${buildNumber}</SCM-Revision> </manifestEntries> </archive> </configuration> </plugin> [...] 

As you can see, the maven archiver is configured twice, with the same identical parameters. Is it possible to avoid such duplication and configure it only once?

ps. I am ready to upgrade to Maven 3 to solve this problem.

+4
source share
2 answers

AFAIK, there is no good way. You can write your own Maven plugin and call WAR and JAR plugins using the Mojo Executor: http://code.google.com/p/mojo-executor/ This is a more common problem with Maven 2: it does not allow reuse wait properties POM code and custom plugins. AFAIK will improve with Maven 3.

+1
source

Looks like Maven 3 Mixins is exactly for this purpose ...

0
source

All Articles