Even if we used a dependency management tool, the junit/ant integration
still requires that developers have the ant-junit bindings (aka:
ant-junit.jar) in the class path when the build.xml is parsed. supposedly
you can explicitly declare the junit tasks with your own taskdef and
identify the location of the jars yourself) but the jars still have to
exist when that taskdef is evaluated -- which makes it hard to then pull
those jars as part of a target.

Everybody i've ever talked to who i felt confident knew more about ant
then me (with Erik at teh top of the list) has said the same thing: "Put
junit and ant-junit in your ANT_LIB ... don't even try to do anything
else, it will just burn you."


we do the following:

<path id="junit.classpath">
  <pathelement location="somePathInSVN/junit-4.1.jar" />
</path>

<target name="test" depends="compile, compiletests">
  <junit>
  <classpath>
    <path refid="junit.classpath"/>
    and so on....

it works nicely for all the main targets (compile, test, etc). i also just verified that the same method works in the solr build file. it guarantees that everyone is running the exact same version of junit and doesn't require any extra steps for developers to be able to build/test code. there are lots of other ways to do this including a custom task def but the above method is pretty straightforward and ~vanilla ant.

- will


Reply via email to