Skip to content

Compile and run the program using maven

Leejjon edited this page Jan 14, 2014 · 2 revisions

Building & Deploying

Using Maven to build and deploy your application for the various backends is simple.

Desktop

To create a runnable jar file for the desktop, run:

mvn -Pdesktop package

This will create a file called test-desktop-1.0-SNAPSHOT-jar-with-dependencies.jar in the test/desktop/target folder. It contains all the necessary dependencies, the assets and a manifest file specifying the main class. You can run this file via:

java -jar test-desktop-1.0-SNAPSHOT-jar-with-dependencies.jar

Android

To create an unsigned APK for Android, run:

mvn -Pandroid package

This will create a file called test-android-1.0-SNAPSHOT.apk in the test/android/target folder. To install the apk to a connected device or emulator, run

mvn -Pandroid install

For more information on Android goals, see the Maven Android plugin

HTML5/GWT

To compile the HTML5 project to JavaScript, run:

mvn -Phtml package

The end result is located in the target/ folder. You can either use the .war file that was generated and deploy that to Jetty/Tomcat, or copy the contents of the HTML/target/test-html-1.0-SNAPSHOT/ folder to a location your web server can server(or even better, create a sym-link if you are on an appropriate OS). The war/folder contains all the compiled JavaScript code, the index HTML file and the assets.

To run and test the HTML5 project, run:

mvn -Phtml install

And browse to http://127.0.0.1:8080/index.html