开发者

way to merge jars in maven?

开发者 https://www.devze.com 2023-01-18 10:27 出处:网络
I have a maven 开发者_如何学Pythonproject which uses the shade plugin to create a jar from several projects.

I have a maven 开发者_如何学Pythonproject which uses the shade plugin to create a jar from several projects.

In addition it is possible with this plugin to create a source jar from these several projects.

For legacy reason we need to have one jar which contains classes and sources, so the combination of the two jars created by the shade plugin.

What is the best way (preferable in maven) to merge these two jars ?

I found the One-Jar but this apparently combines all dependencies - but I want to explictly say "merge this jar and that jar".

Thanks for any help


One possibility is to use the maven assembly plugin to create a single jar specifying and if required, maven dependency plugin.


A simpler way is to tell maven that the source folder is also a resource folder.

Like this :

  <build>
   ...
    <resources>
        <resource>
            <directory>src/main/java</directory>
        </resource>
    </resources>
  ...
  </build>
0

精彩评论

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