怎样才能获得蚂蚁从定制Java系统属性的值 [英] How can Ant get the value from custom Java system property

查看:127
本文介绍了怎样才能获得蚂蚁从定制Java系统属性的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Java类我有

System.setProperty("test", drinks);

在我的Ant构建文件我能够执行java的类。
我怎样才能使用的名称测试得到的结果$ {}饮料在蚂蚁??

In my Ant build file I am able to execute the jave class. How can I use the name "test" to get the result ${drinks} in Ant ??

推荐答案

这是唯一可行的方法是,如果您在使用属性的叉=false的的(假是默认值) 的Java Ant任务。也就是说,如果你的Java程序在同一个JVM蚂蚁执行。否则,你的Java程序将在一个单独的进程中执行,没有它设置将VBE到Ant访问的系统性能。要小心,虽然,执行非派生的Java程序可能会(常会)对Ant构建其余不良副作用。

The only way this is possible is if you use the attribute fork="false" (false being the default value) in the java Ant task. That is, if your Java program is executed in the same JVM as Ant. Otherwise, your Java program will be executed in a separate process and none of the system properties it sets will vbe accessible to Ant. Beware, though, that executing a non-forked Java program may (and often will) have undesired side effects on the rest of the Ant build.

这篇关于怎样才能获得蚂蚁从定制Java系统属性的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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