如何在一个maven命令中执行多个目标,但每个目标使用不同的参数 [英] How to execute multiple goals in one maven command, but with different arguments for each goal

查看:132
本文介绍了如何在一个maven命令中执行多个目标,但每个目标使用不同的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个maven命令中运行2个maven目标,如:

I am trying to run 2 maven goals in one maven command like:

mvn release:prepare release:perform -Darguments='-Dmaven.test.skip=true'

但是,我想跳过第一个目标测试,第二个不跳过测试。

but, I would like the first goal to skip tests and the second one not to skip tests.

它必须在一行命令中。

是除了在2个单独的命令中执行它们之外还有办法吗?

Is there a way to do it other than executing them in 2 separate commands?

推荐答案

您可以使用以下命令:

mvn -Dmaven.test.skip=true release:prepare release:perform

在release-plugin中,参数通过 -Darguments ='....'传递给子流程由发布:执行启动。其他参数传递给由 release:prepare 启动的进程。

Within release-plugin the arguments are passed via -Darguments='....' to the sub process which is started by release:perform. The other arguments are passed to the process which is started by release:prepare.

这篇关于如何在一个maven命令中执行多个目标,但每个目标使用不同的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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