开发者

Specifying an alternate name for junit.jar for the ant junit task

开发者 https://www.devze.com 2023-03-08 06:54 出处:网络
By default JUnit jars have the version number in the file name, eg junit-4.8.2.jar. The JUnit Ant Task only looks for junit.jar. Is it possible to specify a name based on the standard naming conventio

By default JUnit jars have the version number in the file name, eg junit-4.8.2.jar. The JUnit Ant Task only looks for junit.jar. Is it possible to specify a name based on the standard naming convention. I'd like to do so because I want to reference libs in my l开发者_StackOverflowocal maven repository.


Actually, JUnit task documentation gives you a few alternatives:

Note: You must have junit.jar available. You can do one of:

    Put both junit.jar and ant-junit.jar in ANT_HOME/lib.
    Do not put either in ANT_HOME/lib, and instead include their locations in your CLASSPATH environment variable.
    Add both JARs to your classpath using -lib.
    Specify the locations of both JARs using a <classpath> element in a <taskdef> in the build file.
    Leave ant-junit.jar in its default location in ANT_HOME/lib but include junit.jar in the <classpath> passed to <junit>. (since Ant 1.7)

EDIT

This is what you need.

<junit
   ...
>
  <classpath>
    <pathelement location="/path/to/your/custom/junit-4.8.2.jar""/>
    <path refid="your.other.classpath.dependencies" />
  </classpath>
  ...
</junit>
0

精彩评论

暂无评论...
验证码 换一张
取 消