Is it possible to avoid duplication of maven archiver configuration?
This is my parent pom.xml
:
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</vers开发者_C百科ion>
<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 see, maven archiver is configured twice, with identically same parameters. Is it possible to avoid such duplication and configure it only once?
ps. I'm ready to migrate to Maven 3 to solve this problem.
AFAIK, there's no good way. You can write your own Maven plugin and invoke WAR and JAR plugins with Mojo Executor: http://code.google.com/p/mojo-executor/ This is a more general problem with Maven 2: it doesn't allow any POM code reuse expect properties, and custom plugins. AFAIK things are going to improve with Maven 3.
Looks like Maven 3 Mixins is exactly for this purpose...
精彩评论