You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Moses Guillen <mg...@fedex.com> on 2004/01/13 22:21:10 UTC

JUnit problem with ANT 1.6

This problem is similar to John Hohlen (1/6/2004) "Can't Run JUnits With ANT
1.6"

I check Antoine's reply, however no luck.

Here are my findings:

I am in the process of migrating build scripts from ANT 1.5.4 to 1.6.  The
migration
has gone relatively smooth until, I execute a target that has JUnit task I
get the following error:

    [junit] Exception in thread "main" java.lang.VerifyError: (class:
org/apache/tools/ant/taskdefs/optional/junit/FormatterElement, method:
shouldUse signature: (Lorg/apache/tools/ant/Task;)Z) Incompatible object
argument for function call
    [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.createAndStoreF
ormatter(JUnitTestRunner.java:578)
    [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:531)


Here is the junit task that is failing in my build.xml file:

<junit haltonfailure="false"
       printsummary="false"
       fork="on"
       errorProperty="test.failed"
       showoutput="true"
       dir="${env.DEVROOT}/test">
    <classpath refid="test.classpath"/>
    <sysproperty key="oll.config.file"
value="${env.DEVROOT}/properties/oll.properties.${env.USER}"/>
    <sysproperty key="LOGPROPERTIESFILE"
value="${env.DEVROOT}/properties/log4j.properties"/>
    <sysproperty key="MAINLOGFILE" value="main.log"/>
    <formatter type="brief" usefile="false"/>
    <formatter type="xml"/>
    <batchtest todir="${test.data.dir}">
       <fileset dir="${build.dir}" includes="**/Test*.class"/>
    </batchtest>
</junit>

If I turn the forking off and comment out the line <formatter type="xml"/>
it works.  However, this
still does not fix the core problem.  If anyone has any suggestions or
solutions to fixing the problem
or work around, it would be greatly appreciated.

Moses


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: JUnit problem with ANT 1.6

Posted by Moses Guillen <mg...@fedex.com>.
It was not apparent that it was the classpath, due to not including any
specific ant stuff in the classpath.  At least I thought.

However, after taking a look in my classpath I was including weblogic.jar
(WebLogic 6.1 sp4) in my class path to compile and resolve dependencies.
After reviewing the contents of the jar, I noticed some ant related classes.

Apparently, the ant classes from the weblogic.jar were being used instead of
the classes from:
 
${env.ANT_HOME}/lib/ant-junit.jar;${env.ANT_HOME}/lib/junit.jar

I verified my classpath with command line parameters -v (verbose) or -d
(debug) and I noticed that weblogic.jar was in the classspath before any
jars in ${env.ANT_HOME}/lib.

To get around the problem, I simply included the ${env.ANT_HOME}/lib folder
before the weblogic.jar and everything worked fine.

+       <fileset dir="${env.ANT_HOME}/lib" includes="*.jar"/>
        <pathelement location="${env.WL_HOME}/lib/weblogic.jar"/>

Thanks Stefan.

Moses

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org] 
Sent: Wednesday, January 14, 2004 12:32 AM
To: user@ant.apache.org
Subject: Re: JUnit problem with ANT 1.6

On Tue, 13 Jan 2004, Moses Guillen <mg...@fedex.com> wrote:

>     [junit] Exception in thread "main" java.lang.VerifyError:
>     (class:
>     org/apache/tools/ant/taskdefs/optional/junit/FormatterElement,
>     method: shouldUse signature: (Lorg/apache/tools/ant/Task;)Z)
>     Incompatible object argument for function call

Sounds as if you were mixing parts of different Ant versions.  Check
you CLASSPATH for occurances of old ant.jar or optional.jar elements.

> If I turn the forking off and comment out the line <formatter
> type="xml"/> it works.

*AND* or *OR*?

Does it work with forking but without the XML formatter?  Does a
non-forked version with XML formatter work?

Smells like optional.jar from Ant 1.5.x in the CLASSPATH somewhere.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnit problem with ANT 1.6

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 13 Jan 2004, Moses Guillen <mg...@fedex.com> wrote:

>     [junit] Exception in thread "main" java.lang.VerifyError:
>     (class:
>     org/apache/tools/ant/taskdefs/optional/junit/FormatterElement,
>     method: shouldUse signature: (Lorg/apache/tools/ant/Task;)Z)
>     Incompatible object argument for function call

Sounds as if you were mixing parts of different Ant versions.  Check
you CLASSPATH for occurances of old ant.jar or optional.jar elements.

> If I turn the forking off and comment out the line <formatter
> type="xml"/> it works.

*AND* or *OR*?

Does it work with forking but without the XML formatter?  Does a
non-forked version with XML formatter work?

Smells like optional.jar from Ant 1.5.x in the CLASSPATH somewhere.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org