问题
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