开发者

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 form开发者_JAVA技巧at (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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜