0

I'm developing a simple, stand-alone, command line Java application. The project is managed by Maven. I'd like to build a deliverable, which can be copied and run on the client's machine.

I'm using the maven assembly plugin, the desired output is a single zip file containing:

  • my_product.jar : only my classes, without dependencies
  • lib/ : a lib folder containing all the dependencies in .jar format (e.g. lib/log4j.jar, lib/commons-lang.jar)
  • a starter script file (copied from somewhere in the project)

How to describe this in an assembly-descriptor file? I'm having trouble creating my_product.jar into the assembly.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Karl
  • 3,170
  • 1
  • 21
  • 28

2 Answers2

1

Did you take a look at the predefined assemby jar-with-dependencies? It should suit your needs.

See this answer for a detailed discussion of creating executable JAR distributions with maven.

Community
  • 1
  • 1
Thomas
  • 2,231
  • 1
  • 19
  • 27
0

The predefined 'jar-with-dependencies' assembly is a joke. The problem had been solved by external assistance and heavy customization of the pom.xml and assembly descriptor.

It seems if you diverge from the standard Java EE/webapp path towards the standalone applications then you have to prepare for extensive maven customizations.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Karl
  • 3,170
  • 1
  • 21
  • 28
  • Sorry, don't have access to it any more – Karl Mar 05 '12 at 14:53
  • No worries: I found this to be very helpful: http://www.petrikainulainen.net/programming/tips-and-tricks/creating-a-runnable-binary-distribution-with-maven-assembly-plugin/ – Guus Mar 06 '12 at 20:03