如何使Maven程序集插件复制工件? [英] How to get maven assembly plugin to copy artifact?

查看:153
本文介绍了如何使Maven程序集插件复制工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Maven程序集脚本,该脚本可复制资源以构建我们的应用程序.我需要将一些战争文件从单独的外部项目复制到输出中的/webapps目录中.似乎找不到执行此操作的魔术命令.

I have a Maven assembly script that copies resources to build our app. I need to copy some war files from separate, external projects into a /webapps directory in the output. Can't seem to find the magic commands to do it.

我尝试使用<include com.mygroup:mywarfile>向程序集添加一个dependencySet.如果我将"mywarfile"添加为具有编译或运行时范围的项目中的war依赖项,则此方法有效.不幸的是,我的项目引发了一场战争,而maven-war-plugin包含了外部mywarfile作为覆盖,这是我所不希望的.

I tried adding a dependencySet to the assembly with <include com.mygroup:mywarfile>. This works if I add 'mywarfile' as a war dependency in the project with a scope of compile or runtime. Unfortunately, my project produces a war, and the maven-war-plugin includes the external mywarfile as an overlay, which I don't want.

如果我将外部战争依赖项的范围设置为提供或测试,则程序集将失败,并显示警告:

If I set the scope of the external war dependency to provided or test, the assembly fails with the warning:

[警告]此工件包含过滤器从未触发以下模式: 'com.mygroup:mywarfile'

[WARNING] The following patterns were never triggered in this artifact inclusion filter: 'com.mygroup:mywarfile'

我要做的就是让程序集将工件从本地存储库复制到程序集输出.如何做到而又不会弄乱项目的其他部分?

All I want to do is have the assembly copy an artifact from my local repo to the assembly output. How to do it without messing up other parts of the project?

推荐答案

maven-assembly-plugin不用于复制.复制依赖关系的更好方法是 maven-dependency-plugin ,它可以复制依赖关系等等.如果您谈论到Tomcat等中的部署,则应该更深入地研究 carg2-maven-plugin tomcat-maven-plugin 似乎更适合任务.

The maven-assembly-plugin is not intended for copying. The better way to copy dependencies is the maven-dependency-plugin which can copy dependencies etc. If you a talking about deployment into Tomcat etc. than you should take a deeper look into carg2-maven-plugin or the tomcat-maven-plugin which seemed to be more appropriate for that task.

这篇关于如何使Maven程序集插件复制工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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