Maven:如何将工件复制到特定目录? [英] Maven: how to copy artifact to specific directory?

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

问题描述

安装目标将工件复制到目标目录和本地存储库。

The "install" goal copies the artifact to the target directory and to the local repository.

如何告诉Maven将其复制到给定目录(例如JBoss的deploy目录)。

How can I tell Maven to copy it also to a given directory (like the deploy directory of JBoss for example).

推荐答案

目标 copy 做你想做的事,看看 example

The goal copy of maven-dependency-plugin does what you want, see the example.

然而,这不是一个最好复制目标目录之外的任何内容(或者 $ {project.build.directory} ) - 特别是如果此类操作附加到构建阶段,因为它引入了构建的意外副作用,有时甚至丧失了可重复性。

It is however not a good idea to copy anything outside your target directory (or ${project.build.directory} to be precise) - especially if such action is attached to a build phase, because it introduces unexpected side-effects of the build, and sometimes even loss of reproducibility.

正如@Andreas_D所说,有一个更好的JBoss部署目的;类似地,部署到其他appservers。

As @Andreas_D notes, there is a better alternative for JBoss deployment purpose; similarly for deploying to other appservers.

这篇关于Maven:如何将工件复制到特定目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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