Skip to content
Advertisement

Maven Multiple platform dependent Packages

I have written an application in Java that can be used on both Linux and Windows. Currently by running mvn package, my maven build system will generate a .msi using WiX.

Is there a way of creating two package ‘tasks’ so I can say either mvn package-windows ormvn package-linux`

Advertisement

Answer

If you want to package both versions (Linux and Windows), you can bind your mvn package phase to an extra phase that would build another artifact.

...
 <plugin>
   <groupId>org.group.extra</groupId>
   <artifactId>extra-maven-plugin</artifactId>
   <version>1.4</version>
   <executions>
     <execution>
       [...]
       </configuration>
       <goals>
         <goal>package</goal>
       </goals>
     </execution>
   </executions>
 </plugin>
...

It was probably what you have already done with maven-wix-plugin.

Advertisement