开发者

Using maven to create two artifacts with overlapping classes

I have a maven pom that creates an artifact, let's call it everything.jar.

I would like to copy a subset of the classes in everything.jar into another jar, let's call it mini.jar.

What's the best way to structure my maven pom(s) to produce two jar files,开发者_如何学C one called mini.jar with just a few classes, and the other everything.jar with everything in mini plus some additional classes, without actually making copies of the source?


I'd do it the other way around.

Create a multi - module project:

      root
    /  |   \
mini extra everything
  • mini contains the core stuff
  • extra has a dependency to mini and defines the additional classes
  • everything has a dependency to both and uses the maven-shade-plugin to create a combined jar from the two other projects (you can also do that from inside the extra project, but I'd call that less elegant)

Reference:

  • shade:shade mojo
  • Selecting Contents for Uber JAR
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜