简体   繁体   English

用JUnit编译ant classpath问题

[英]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: 我的蚂蚁有编译问题,找不到junit.jar,这是我的构建文件:

<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: 我不确定我是否理解,因为在-verbose模式下的ant确实找到了我JUnit jar,请参见所附的屏幕截图:

错误

This should compile fine in Ant. 这在Ant中应该可以编译。 Make sure you're using a recent version of JUnit. 确保您使用的是最新版本的JUnit。 Old versions (eg 3.8.1) have different package hierarchies than JUnit 4.x. 旧版本(例如3.8.1)与JUnit 4.x具有不同的包层次结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM