How can Ant get the value from custom Java system property

故事扮演 提交于 2019-12-12 01:24:06

问题


In my java class I have

System.setProperty("test", drinks);

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 ??


回答1:


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.



来源:https://stackoverflow.com/questions/23477880/how-can-ant-get-the-value-from-custom-java-system-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!