Maven多模块项目-将所有依赖项复制到一个tar.gz中 [英] Maven multi-module project - copying all dependencies into a single tar.gz

查看:392
本文介绍了Maven多模块项目-将所有依赖项复制到一个tar.gz中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从maven项目的每个模块中提取所有依赖项,并使用maven-assembly-plugin将它们粘贴到单个tar.gz文件中.

I'm looking to pull all of the dependencies from each module of my maven project and stick them into a single tar.gz file using the maven-assembly-plugin.

我目前有一个pom设置作为所有模块的父级.我的想法是使用maven-dependency-plugin将所有依赖项复制到父目录中的单个文件夹中,但是当我使用

I currently have a pom setup as a parent to all of the modules. My idea was to use the maven-dependency-plugin to copy all of the dependencies to a single folder in the parents directory however when i use

<configuration>
    <outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>

将依赖项复制到模块构建目录中.有什么办法可以在父项目中将此输出目录设置为一个?

The dependencies are copied into the modules build directory. Is there any way to set this output directory to one inside the parent project?

推荐答案

您正在以错误的方式进行操作.

You are going at it the wrong way.

您应该创建另一个模块来负责创建该存档,而不是在父POM中创建该存档.这个新模块将依赖于所有其他模块.

Instead of creating this archive inside the parent POM, you should create another module which will be responsible for creating it. This new module will have dependencies on all the other modules.

要创建档案,您需要使用 maven-assembly-plugin .我强烈建议您阅读第8章.让您开始使用程序集.基本上,程序集是通过程序集描述符创建的.在您的情况下,您将需要配置此描述符以使用tar.gz格式.

To create the archive, you need to use the maven-assembly-plugin. I strongly suggest that you read Chapter 8. Maven Assemblies of the Maven book to get you started with using assemblies. Basically, an assembly is created with the help of an assembly descriptor. In your case, you will need to configure this descriptor to use the tar.gz format.

这篇关于Maven多模块项目-将所有依赖项复制到一个tar.gz中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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