How to create self-containing (standalone) jar of each modules of a multi-module maven project

后端 未结 2 1578
面向向阳花
面向向阳花 2021-01-15 02:41

I have a multi-module maven project. The parent POM and individual module\'s pom are working fine (because code in each module runs fine without any dependency issue and

相关标签:
2条回答
  • 2021-01-15 02:52

    I did this with the AppAssembler maven plugin. It auto copies all needed dependencies and creates shortcuts for your main classes. It's much easier then other plugins I tried.

    For the uber-jar applications I use maven-shade-plugin for merging jars into one + proguard for shrinking, but AppAssembler is much quicker and stable to use.

    0 讨论(0)
  • 2021-01-15 03:04

    If you want all the dependencies in the jars, you'll need to create an uberjar. Putting the dependencies in the jar is not the way jars normally work. An uberjar lets you do that though. Shade is a plugin that builds one in java. You can also do it this way: How can I create an executable JAR with dependencies using Maven?

    If you want to create a lib folder, here's an answer that will explain how: force Maven2 to copy dependencies into target/lib

    0 讨论(0)
提交回复
热议问题