为一个多模块项目创建所有jar和源jar的归档文件 [英] Creating an archive of all jars and source jars for a multi-module project

查看:106
本文介绍了为一个多模块项目创建所有jar和源jar的归档文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Maven项目,其中有六个模块.

I'm building a Maven project which has half a dozen modules.

我可以自己使用Maven或Ivy导入它,但是其他团队也希望使用这些jar,但是他们的做法是将jar和源jar提交到版本控制中.

I'm fine with importing it myself using either Maven or Ivy, but other teams would like to use those jars as well, but their practice is to commit the jars and source jars to version control.

我想为所有模块及其源生成一个zip/tar程序集,他们可以根据需要使用它们.

I'd like to generate a zip/tar assembly of all modules and their sources which they can use however they like.

我已阅读 Maven组件插件:包括模块二进制文件,但我不愿意使用它,因为:

I've read Maven Assembly Plugin: Including Module Binaries but I'm shy of using it because:

  1. 链接的常见问题解答条目返回404;
  2. 我需要手动指定所有模块.
  1. The linked FAQ entry returns a 404;
  2. I need to manually specify all modules.

还有其他选择吗?

更新:我尝试使用内置的程序集描述符

Update: I've tried using the built-in assembly descriptors

 mvn assembly:assembly -DprojectModulesOnly=true
 mvn assembly:assembly

都失败了

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive bin: You must set at least one file.

所有模块构建都运行完之后.

right after all the module builds have run.

推荐答案

我认为您是对的,程序集插件的moduleSets选项可以处理您要执行的操作.

I think you're on the right lines, the moduleSets options of the assembly plugin handles what you're after.

如果您正在寻找一些有用的文档,请

If you're looking for some useful documentation, the Module Selection section of the Maven book covers it quite thoroughly, including how to configure includes and excludes, handle binaries and sources, and exclude external dependencies.

这篇关于为一个多模块项目创建所有jar和源jar的归档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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