Jerome Ansia
Jerome Ansia

Reputation: 6884

Compile with ant classpath issue with JUnit

I am having a compile issue with ant, junit.jar cannot be found here is my build file:

<path id="lib">
    <fileset dir="library">
        <include name="*.jar" />
    </fileset>
</path>

<target name="test">
    <mkdir dir="tmp/reports" />

      <mkdir dir="tmp/build" />
        <javac srcdir="test" destdir="tmp/build" includeantruntime="false">
            <classpath refid="lib" />
        </javac>
        <echo message="Build done" />


    <junit fork="yes" haltonfailure="yes">

        <batchtest todir="tmp/reports">
            <fileset dir="tmp/test">
                <include name="*.java" />
            </fileset>
        </batchtest>
        <formatter type="xml" usefile="true"/>
        <classpath refid="test.classpath" />
    </junit>
</target>

I am not sure i understand because ant in -verbose mode did find me JUnit jar see attached screenshot:

error

Upvotes: 1

Views: 116

Answers (1)

M A
M A

Reputation: 72854

This should compile fine in Ant. Make sure you're using a recent version of JUnit. Old versions (e.g. 3.8.1) have different package hierarchies than JUnit 4.x.

Upvotes: 2

Related Questions