DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=44444>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44444 Summary: When invoking <java> task under ant, system props do not seem to be inherited as the docs imply they should be. CLB_POST Product: Ant Version: 1.7.0RC1 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Core tasks AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] Hi, I am pretty sure this is a bug, but maybe someone can point out something i overlooked. many thanks, in advance, for your help... I have a very simple java file 'PropTest.java' that prints out the value of the system property 'prop'. When i run the test from the command line (using java command and -Dprop=somevalue), I see that the value that I set for 'prop' is indeed dumped out. But when I set up a simple ant build.xml file to invoke the program via the <java> task it appears that the value of the system property that i set on the command line is not propagated... It seems that it is somehow swallowed and lost by ant. Below you will find examples of the runs of the program via ant and via the 'java' command. Below the run output you will find the source code for these very simple test cases. RUN OUTPUT ----------- ------------------------->>>> java -Dprop=blah PropTest # INPUT, corresponding output follows on next line property: blah ------------------------->>>>> ant -Dprop=blah run # INPUT, corresponding output follows on next line Searching for build.xml ... Buildfile: /home/cbedford/.hudson/jobs/cbedford.KMIGRATE.javaOnly.cbedford-linux.mygazoo.com.12753/workspace/kernel/platform/functionaltest/src/java/build.xml run: [echo] dumping out value of property in ant, right before invoking java task: blah [java] property: null BUILD SUCCESSFUL ------------------------->>>> ant -version # INPUT, corresponding output follows on next line Apache Ant version 1.7.0 compiled on December 13 2006 SOURCE CODE ----------- public class PropTest { public static void main(String[] args) { String propValue = System.getProperty("prop"); System.out.println("property: " + propValue ); } } build.xml --------- <project name="demo" default="run" basedir="." > <path id="classpath.runjava"> <path location="${basedir}"/> </path> <target name="run" > <echo level="info" message=" dumping out value of property in ant, right before invoking java task: ${prop}"/> <!-- tried fork="false".. had no effect... <java classname="PropTest" fork="false"> --> <!-- tried it without clonevm, had no effect... <java classname="PropTest" fork="false"> --> <!-- tried it with clonevm=true, no fork specified... had no effect. <java classname="PropTest" fork="false"> --> <java classname="PropTest" clonevm="true" fork="true"> <classpath refid="classpath.runjava"/> </java> </target> </project> Relevant Documentation: http://ant.apache.org/manual/CoreTasks/java.html Particularly relevant on this page is the text which reads: clonevm If set to true true, then all system properties and the bootclasspath of the forked Java Virtual Machine will be the same as those of the Java VM running Ant. Default is "false" (ignored if fork is disabled). since Ant 1.7 -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
