HIBERNATE  |  Register  | 
      SEARCH: 
   
News 
Features 
Documentation 
   Related Projects 
   External Documentation 
Download 
Forum & Mailinglists 
Support 
JIRA Issue Tracking
Wiki Community Area


JBoss.org



middlegen

JIRA Issue Tracking




      
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 web collaboration