You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by metcox <me...@gmail.com> on 2008/12/28 15:59:58 UTC

junittask includeantruntime attribute doesn't work as expected

Hi,

I'm trying to use junittask with fork mode on, on a project with ant dependencies.
So I set includeantruntime to false and fork to true but I have conflicts.

I'm working with java 1.6.0_10 and ant 1.7.1 and I'm getting the following output:

     [junit] WARNING: multiple versions of ant detected in path for junit
     [junit]          jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
     [junit]      and jar:file:/home/metcox/dev/workspace/junitTaskTest/lib/ant-1.6.5.jar!/org/apache/tools/ant/Project.class
     [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0,001 sec
     [junit] Running MainTest
     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
     [junit] Test MainTest FAILED (crashed)

If I understand correctly, the test crashed because there are both ant 1.6.5 and 1.7.1 jars in the classpath but 1.7.1 jars shouldn't be here
I have no crash if the project have ant 1.7 dependencies but I still have the warning.

Does includeantruntime attribute work properly or did I misuse it?

a simple build.xml to reproduce this issue:

<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="default">

         <target name="default" depends="clean, compile-test">
                 <junit fork="true" includeantruntime="false" printsummary="yes">
                         <classpath>
                                 <pathelement path="${basedir}/bin" />
                                 <pathelement location="${basedir}/lib/junit-4.2.jar" />
                                 <pathelement location="${basedir}/lib/ant-1.6.5.jar" />
                                 <pathelement location="${basedir}/lib/ant-junit-1.6.5.jar" />
                                 <pathelement location="${basedir}/lib/ant-launcher-1.6.5.jar" />
                         </classpath>
                         <test name="MainTest" />
                 </junit>
         </target>

         <target name="compile-test">
                 <mkdir dir="${basedir}/bin" />
                 <javac srcdir="${basedir}/src" destdir="${basedir}/bin" fork="true" includeantruntime="false">
                         <classpath>
                                 <pathelement location="${basedir}/lib/junit-4.2.jar" />
                         </classpath>
                 </javac>
         </target>

         <target name="clean">
                 <delete>
                         <fileset dir="${basedir}/bin" />
                 </delete>
         </target>

</project>

Regards, Mathieu



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


Re: junittask includeantruntime attribute doesn't work as expected

Posted by metcox <me...@gmail.com>.
It make sense, but does the purpose of the includeantruntime attribute
to include or not the ant libraries on the classpath?
It seems it does. But why I still have the warning?
And I have the same kind of warning if I use ant 1.7.1 dependencies,
but in this last case the junit test works.

Regards, Mathieu


2008/12/28 Peter Reilly <pe...@gmail.com>:
> You cannot use ant 1.7 with ant 1.6 jars. The ant 1.7 junit task
> is expecting ant 1.7 jars.
>
> Peter
>
>
> On Sun, Dec 28, 2008 at 2:59 PM, metcox <me...@gmail.com> wrote:
>> Hi,
>>
>> I'm trying to use junittask with fork mode on, on a project with ant
>> dependencies.
>> So I set includeantruntime to false and fork to true but I have conflicts.
>>
>> I'm working with java 1.6.0_10 and ant 1.7.1 and I'm getting the following
>> output:
>>
>>    [junit] WARNING: multiple versions of ant detected in path for junit
>>    [junit]
>>  jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
>>    [junit]      and
>> jar:file:/home/metcox/dev/workspace/junitTaskTest/lib/ant-1.6.5.jar!/org/apache/tools/ant/Project.class
>>    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0,001 sec
>>    [junit] Running MainTest
>>    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>>    [junit] Test MainTest FAILED (crashed)
>>
>> If I understand correctly, the test crashed because there are both ant 1.6.5
>> and 1.7.1 jars in the classpath but 1.7.1 jars shouldn't be here
>> I have no crash if the project have ant 1.7 dependencies but I still have
>> the warning.
>>
>> Does includeantruntime attribute work properly or did I misuse it?
>>

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


Re: junittask includeantruntime attribute doesn't work as expected

Posted by Peter Reilly <pe...@gmail.com>.
You cannot use ant 1.7 with ant 1.6 jars. The ant 1.7 junit task
is expecting ant 1.7 jars.

Peter


On Sun, Dec 28, 2008 at 2:59 PM, metcox <me...@gmail.com> wrote:
> Hi,
>
> I'm trying to use junittask with fork mode on, on a project with ant
> dependencies.
> So I set includeantruntime to false and fork to true but I have conflicts.
>
> I'm working with java 1.6.0_10 and ant 1.7.1 and I'm getting the following
> output:
>
>    [junit] WARNING: multiple versions of ant detected in path for junit
>    [junit]
>  jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
>    [junit]      and
> jar:file:/home/metcox/dev/workspace/junitTaskTest/lib/ant-1.6.5.jar!/org/apache/tools/ant/Project.class
>    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0,001 sec
>    [junit] Running MainTest
>    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>    [junit] Test MainTest FAILED (crashed)
>
> If I understand correctly, the test crashed because there are both ant 1.6.5
> and 1.7.1 jars in the classpath but 1.7.1 jars shouldn't be here
> I have no crash if the project have ant 1.7 dependencies but I still have
> the warning.
>
> Does includeantruntime attribute work properly or did I misuse it?
>
> a simple build.xml to reproduce this issue:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="project" default="default">
>
>        <target name="default" depends="clean, compile-test">
>                <junit fork="true" includeantruntime="false"
> printsummary="yes">
>                        <classpath>
>                                <pathelement path="${basedir}/bin" />
>                                <pathelement
> location="${basedir}/lib/junit-4.2.jar" />
>                                <pathelement
> location="${basedir}/lib/ant-1.6.5.jar" />
>                                <pathelement
> location="${basedir}/lib/ant-junit-1.6.5.jar" />
>                                <pathelement
> location="${basedir}/lib/ant-launcher-1.6.5.jar" />
>                        </classpath>
>                        <test name="MainTest" />
>                </junit>
>        </target>
>
>        <target name="compile-test">
>                <mkdir dir="${basedir}/bin" />
>                <javac srcdir="${basedir}/src" destdir="${basedir}/bin"
> fork="true" includeantruntime="false">
>                        <classpath>
>                                <pathelement
> location="${basedir}/lib/junit-4.2.jar" />
>                        </classpath>
>                </javac>
>        </target>
>
>        <target name="clean">
>                <delete>
>                        <fileset dir="${basedir}/bin" />
>                </delete>
>        </target>
>
> </project>
>
> Regards, Mathieu
>
>
>
> ---------------------------------------------------------------------
> 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