HIBERNATE JBoss.org
 |  Register  | 
     
News 
About 
   Feature List 
   Road Map 
Documentation 
   Related Projects 
   External Documentation 
Download 
Forum & Mailinglists 
Support & Training 
JIRA Issue Tracking
Wiki Community Area


Hibernate Public Training Courses


Get Hibernate in Action eBook!


JavaWorld 2003 Finalist


Jolt Award 2004 Winner
      
Documentation > Community Area > Testing with Ant & Junit

Testing with Ant & Junit

From the Forum:

Ant uses an XML processor version that conflicts with Hibernate. I was getting a java.lang.LinkageError when I tried to run my JUnit tests from inside of Ant. The solution is to fork the VM, so it does not use the classes loaded by Ant. Here is my target as an example. Notice the fork="true" in the junit line.

<target name="test-unit-persistance" depends="create-db">
    <junit printsummary="false" haltonfailure="true" fork="true">
        <formatter type="brief" usefile="false" />
        <batchtest>
            <fileset dir="${src.class.home}" includes="**/*Test.class" />
        </batchtest>
        <classpath>
            <fileset dir="WEB-INF/lib/hibernate">
                 <include name="*.jar" />
            </fileset>
        </classpath>
        <classpath location="${src.class.home}"/>
        <classpath location="${generated.db.mapping.dir}"/>
    </junit>    
</target>
      

coWiki