मेरे पास एक build.xml है जो मुझे जूनिट परीक्षण चलाने की अनुमति देता है।चींटी क्लासपाथ और junit.jar
<pathelement location="${eclipse.home}/plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
परिवर्तन classpath टूट जाता है के साथ
<pathelement location="../../../../../eclipse/plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
:
<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>
अगर मैं लाइन की जगह: यहाँ प्रासंगिक हिस्सा है। मुझे निम्न त्रुटि मिलती है:
The
<classpath>
for<junit>
must include junit.jar if not in Ant's own classpath
जहां तक मैं समझता हूं, स्थान विशेषता दोनों मामलों में समान मान रखनी चाहिए। तो कारण क्या हो सकता है?
एक साइड सवाल के रूप में, यह बिल्ड फ़ाइल विभिन्न जूनिट संस्करण (पथ टूट जाएगा) के साथ पर्यावरण पर काम नहीं करेगी। क्या junit.jar के लिए "सामान्य" पथ जोड़ना संभव है?
eclipse.home ठीक से विस्तारित है? $ {Eclipse.home} के लिए –