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

查看:838
本文介绍了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- shade-plugin/index.html

将任意数量的依赖项打包为uber软件包依赖关系.然后可以将其部署到存储库中.

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

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

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