У меня есть build.xml, который позволяет мне запускать тесты junit.Вот соответствующая часть:
<path id="JUnit 4.libraryclasspath">
<pathelement location="../../../../../eclipse/plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
<pathelement location="../../../../../eclipse/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar"/>
</path>
<path id="MyProject.classpath">
<pathelement location="bin"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>
<target name="run_unit_tests" depends="build">
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="MyProject.classpath" />
<formatter type="xml"/>
<batchtest todir="${junit.output.dir}">
<fileset dir="${src}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
Если заменить строку:
<pathelement location="../../../../../eclipse/plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
на
<pathelement location="${eclipse.home}/plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
Изменение нарушает путь к классу.Я получаю следующую ошибку:
<classpath>
для <junit>
должен включать junit.jar, если он не находится в собственном пути к Ant
Насколько я понимаюАтрибут location должен содержать одинаковое значение в обоих случаях.Так в чем же причина?
В качестве дополнительного вопроса этот файл сборки не будет работать в среде с другой версией junit (путь будет поврежден).Можно ли добавить "общий" путь к junit.jar?