views:

34

answers:

2

This is my parent pom.xml:

[...]
<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 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.

+1  A: 

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.

iirekm
A: 

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

Vincenzo