是否可以从ant设置maven属性? [英] Is it possible to set a maven property from ant?

查看:120
本文介绍了是否可以从ant设置maven属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用maven-antrun-plugin来检查是否有文件存在,然后相应地设置属性.在antrun-plugin的另一个执行中(另一个阶段),我想使用该属性.但是,在一个执行中设置的属性不能在另一个执行中使用,因为它是蚂蚁而不是maven属性,并且不会传播.

I tried to use the maven-antrun-plugin to check in a first execution if a file exists and then set a property accordingly. In another execution (another phase) of the antrun-plugin I want to make use of the property. But the property set in one execution cannot be used in another execution since it's an ant and not a maven property and doesn't get propagated.

是否可以将ant属性传播到maven或换句话说从ant设置maven属性?

Is it possible to propagate the ant property to maven or in other words set a maven property from ant?

使用另一个Maven构建,例如

Using another Maven build like in this question is not an option.

另一种可行的方式可能是外部build.xml,但这也不是一种选择,因为我必须将内容保存在一个pom中.

Another way that might work somehow would be an external build.xml but that's not an option too, because I have to keep things in one pom.

我已经读过有关使用 GMaven 来设置Maven属性的信息,但是我想和蚂蚁呆在一起.

I've read about using GMaven to set a Maven property but I would like to stay with ant.

推荐答案

从maven-antrun-plugin 1.7版本开始,根据

As of version 1.7 of the maven-antrun-plugin it is possible according to the plugin documentation (see exportAntProperties). So, I guess, in earlier versions: it's not ;-).

这篇关于是否可以从ant设置maven属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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