maven:将多模块项目组装成单个 jar [英] maven: multi-module project assembly into single jar

查看:66
本文介绍了maven:将多模块项目组装成单个 jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块项目,想创建一个包含所有模块类的 jar.在我的父 POM 中,我声明了以下插件:

I have a multi-module project and want to create a single jar containing the classes of all my modules. Inside my parent POM, I declared the following plugin:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-assembly-plugin</artifactId>
 <configuration>
  <descriptorRefs>
   <descriptorRef>bin</descriptorRef>
  </descriptorRefs>
 </configuration>
</plugin>

但是,在运行 mvn assembly:assembly 时,仅包含来自父文件夹(空)的源.我如何将模块中的源文件包含到存档中?

However, when running mvn assembly:assembly, only the source from the parent folder (empty) are included. How do I include the sources from my modules into the archive?

推荐答案

我认为您正在寻找 Maven Shade 插件:

I think you are looking for the Maven Shade Plugin:

http://maven.apache.org/plugins/maven-阴影插件/index.html

将任意数量的依赖项打包成一个超级包依赖项.然后可以将其部署到存储库.

Packages up any number of dependencies into an uber package depenency. This can then be deployed to a repository.

这篇关于maven:将多模块项目组装成单个 jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆