开发者

Creating with Maven two separate jars, without dependencies and with ONLY dependencies

开发者 https://www.devze.com 2023-02-18 12:50 出处:网络
Can Maven create two jars specified in one pom.xml: one jar with my app but without dependencies, and second jar ONLY with dependencies? I\'d like to have two sepa开发者_运维百科rate jars, but I want

Can Maven create two jars specified in one pom.xml: one jar with my app but without dependencies, and second jar ONLY with dependencies? I'd like to have two sepa开发者_运维百科rate jars, but I want to run jar with my app and this app has to 'see' all dependencies in second jar. Everything I want to have in one eclipse project, only in result of one run of mvn:package I'd like to create separate jars...Is it possible? Now I use maven-jar-plugin to create jar with app, where I specify the classpath by add line in configuration of maven-jar-plugin:

<addClasspath>true</addClasspath>

Before I have used maven-assebly-plugin to create jar-with-dependencies, but now I have to create separate jar-s....

Thanks in advance, seishin


Here's how I'd do it:

  • use dependency:unpack to unpack all dependencies to a common folder,
  • use the assembly plugin to create a new JAR from the unpacked dependencies
  • provide a custom manifest to your project's jar that links to the dependency jar
0

精彩评论

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