简体   繁体   中英

Maven assembly plugin: building a distributable Java SE application

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 (eg 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM