Search code examples
javamavenantdistribute

Maven: How to generate a standalone application?


I am using Maven to manage a console application project. On my machine, I type mvn exec:java and Maven handles everything. What I want is, however, to execute the same application on a different machine without the help of Maven.

In NetBeans, Ant projects have a dist directory with all the necessary files. All you have to do is to type java -jar dist/App.jar. How can I make Maven generate such distributable directory or archive?

PS: Although seems relevant, this is not a duplicate of Create a standalone application with Maven.


Solution

  • I have used in maven.

    http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/

    The Application Assembler Plugin is a Maven plugin for generating scripts for starting java applications. All dependencies and the artifact of the project itself are placed in a generated Maven repository in a defined assemble directory. All artifacts (dependencies + the artifact from the project) are added to the classpath in the generated bin scripts.

    and http://maven.apache.org/plugins/maven-assembly-plugin/

    The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.