Maven custom packaging
06:32 04 Sep 2014

I am using a library (RootBeer), which requires an additional build step: after creating my JAR, I have to run the RootBeer JAR with my JAR as its parameter to create the final RootBeer-enabled JAR.

E.g., if my jar is myjar.jar, this is how I have to create the final artefact myjar-final.jar with RootBeer:

java -jar rootbeer.jar myjar.jar myjar-final.jar

I would like to know if there is a mechanism in Maven which would enable me to build an artifact in this way.

Right now I'm using the gmaven-plugin with a Groovy script, but this just feels too hacky, and I'm pretty sure I couldn't use the resulting artefact as a Maven dependency in other projects:


   org.codehaus.groovy.maven
   gmaven-plugin
   
      
         groovy-magic
         package
         
            execute
         
         
             
                println """java -jar target/rootbeer-1.2.0.jar target/myjar.jar target/myjar-final.jar"""
                   .execute().in.eachLine {
                      line -> println line
                }
             
          
       
    

Any suggestions?

java maven