ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: One Ant buildfile calling its subdir buildfile, how to change the base dir?
Date Thu, 12 Jan 2012 16:09:09 GMT
On 2012-01-11, xsli2 wrote:

>         <echo message="sub base dir=${basedir}" />
> 	<target name="MyTest">
> 	    <junit>
> 	      <classpath refid="project.classpath" />
> 	      <formatter type="brief" usefile="false" />
> 	      <test name="A.B.C.MyTest" />
> 	    </junit>
> 	</target>
> Inside MyTest.java, I added this print out:
>         final String currentDir = new File(".").getAbsolutePath();
>         System.out.println("currentDir=" + currentDir);

Ant's basedir and the running Java process' current working directory
are not the same thing.  When you use an <ant> task you only change the
basedir but not the current working directory.  To do that, you'd have
to fork the Java/JUnit process so it is running in a fresh Java VM.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message