BgY
BgY

Reputation: 83

Maven profile plugins

I have a maven application with many profiles defined in pom.xml. I'd like to run webstart-maven-plugin in (almost) each profile. The obvious solution is to copy-paste the plugin definition into the all profile section in pom.xml. But this plugin has many parameters and it's not easy to maintain changes...

Is there a possibility to define the plugin parameters once and reference/include/override this parametrized one in required profiles?

Upvotes: 0

Views: 216

Answers (1)

BgY
BgY

Reputation: 83

I could solve it by defining a parent pom. In parent pom <packaging>pom</packaging> specified and the parametrized webstart-maven-plugin placed in it. The child pom must reference to parent:

<parent>
    <groupId>com.bgy.application</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>./parent.xml</relativePath>
</parent>

In profiles of the child pom where plugin execution not necessary there is:

<plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>webstart-maven-plugin</artifactId>                
     <executions>
         <execution>
             <phase>none</phase>
         </execution>
     </executions>
 </plugin>  

and in profiles where execution necessary:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>webstart-maven-plugin</artifactId>                
</plugin> 

(you can omit this)

Upvotes: 1

Related Questions