JAVA STUFF

 

Assemble a Java application using Maven

tirsdag den 3. november 2009

 

Here’s a short example of how to assemble a Java application using Maven so you have a nice Windows Batch file or a Unix/OS X Shellscript to running your application, as well as all dependencies nicely gathered in a repo folder.


Enter appassembler plugin for Maven.

Add the following to your pom.xml:

















From the command line just issue this mvn command to have your application assembled:

> mvn package appassembler:assemble


This will the create an appassembler folder under the target folder.

Like this:

-target

   -appassembler

      -bin

         -Simulator.bat

         -Simulator

     -repo

        - “all dependecies + the applications own jar”


Btw. under Unix/OS X you have to remember to (the first time) set the executeable bit on the Simulator shell script:

> chmod +x Simulator


After that you can execute it using

> ./Simulator arg1 arg2


Hope this helps :)


Note: Appassembler doesn’t work with local project jars (aka. system dependencies) as described in this blog.

 
 
Made on a Mac
next
3_How_to_reference_a_project_local_jar_in_maven.html
 
2_Handling_Console_Input_with_Auto_completion_in_Java_using_Jline.html
previous