kms333
kms333

Reputation: 3257

How to create a Maven distributable

I would like to create a ZIP distributable for my java application with Maven with the following structure :

/lib -> my generated jars (several modules core.jar, app.jar ... )

/config -> several configuration files (app.properties, ...)

/3rdparty -> all jar dependencies (commons-lang.jar, log4j.jar ... )

/scripts -> helper scripts (start.sh ... )

I would like to deploy this in any client machine and run as :

java -cp ../lib:../3rdparty -Dprop.file=app.properties [main.class]

I have read quite a lot about the maven assembly plugin but have not found a satisfactory answer on how to ahcieve this.

Upvotes: 1

Views: 579

Answers (2)

khmarbaise
khmarbaise

Reputation: 97547

The are of the scripts folder with starting scripts can be done via the appassembler-maven-plugin which creates scripts for running/starting applications. To create a single archive which contains all that stuff you can use the maven-assembly-plugin.

Upvotes: 1

nwinkler
nwinkler

Reputation: 54507

The Maven Assembly plugin is the right thing to use here. There's plenty of examples on how to use it out there, here are some:

Upvotes: 4

Related Questions