Change working directory in ant task junit

I have an ant file that runs JUnits tests. These tests rely on the relative path to specific configuration files. I tried to set the working directory for the batch test, but could not.

I want the working directory to be ${plugins.dir}/${name}

Part of JUnit ant script:

<junit haltonfailure="no" printsummary="on" fork="true" showoutput="true" dir="${plugins.dir}/${name}">
    <jvmarg value="-Duser.dir=${plugins.dir}/${name}"/>
    <classpath> 
        <path refid="project.classpath"/>
        <pathelement location="${plugins.dir}/${dependency}/@dot/"/>
        <pathelement location="${plugins.dir}/${name}/" />
    </classpath>
    <formatter type="xml" />
    <sysproperty key="basedir" value="${plugins.dir}/${name}"/>
    <sysproperty key="dir" value="${plugins.dir}/${name}"/>
    <batchtest todir="${junit.output}">
        <fileset dir="${dir}"> 
            <include name="**\*AllTests.class" />
        </fileset>
    </batchtest>
</junit>

I searched googled and searched, but the workarounds that I found were to install "dir", "sysproperty" or "jvmarg". As you can see, I tried all of them :)

Is there a way to print the current directory in a tag? He does not support. This would allow me to check if the directory has really changed and to what.

, , , antrunner. , junit eclipse plugin junit. , .

+5
3

, basedir (. ). , ANT ( JVM), !

, basedir ANT? . .

ant -Dbasedir=somedir

, ANT, junit. . AntCall Ant . , junit junit. ( basedir.

<antcall target="junit">
  <param name="basedir" value="${plugins.dir}/${name}"/>
</antcall>

<ant dir="${plugins.dir}/${name}" target="junit" />
+5

, , dir="...." , jvm, fork='true', .

Apache "dir - , . , fork .". .

+5

NetBeans. Ant ( , , Java, Ant) work.dir=C:/MyWorkingDir/, ant C:\MyWorkingDir:

ant -f D:\\workspace\\lib\\project -Dfork=true -Djavac.includes=com/myapp/MyTest.java -Dtest.includes=com/myapp/MyTest.java "-Dwork.dir=C:/MyWorkingDir/" test-single
+1
source

All Articles