Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: One Ant buildfile calling its subdir buildfile, how to change the base dir?

Stefan Bodewig

2012-01-12


Author LoginPost Reply
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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.