Ant classpath and junit.jar

前端 未结 2 1286
太阳男子
太阳男子 2021-02-07 08:08

I have the an build.xml that allows me to run junit tests. Here is the relevant part:


    

        
2条回答
  •  不思量自难忘°
    2021-02-07 09:03

    The JUnit library resides wherever you tell it to reside. Personally, I would forget entirely about linking against the jar files shipped with Eclipse and instead download the jars directly.

    If I have a project, say at path /project then I would try to put the dependency somewhere in that hierarchy, like at /project/test/lib/junit.jar. If my ant build file is then /project/build.xml then it's as simple as adding ./test/lib/junit.jar to the JUnit classpath. Trying to reference an arbitrary location on your machine is fragile (remember, Eclipse could be installed anywhere), particularly when using relative paths (since your project contents could also be stored anywhere).

提交回复
热议问题