You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Mark Petrovic <ms...@gmail.com> on 2010/08/28 16:17:23 UTC

Trying to override old definition of datatype junit

I'm seeing 

"Trying to override old definition of datatype junit"

when I run tests on a certain project.  Appears to be the same issue as https://issues.apache.org/jira/browse/BUILDR-161.

What causes this?

--
Mark Petrovic



Re: Trying to override old definition of datatype junit

Posted by Mark Petrovic <ms...@gmail.com>.
I converted my tests to JUnit4, but I'm still getting the "Trying to override old definition of datatype junit":

1) Here's the console output

$ mini:webserver> buildr test
(in /Users/petrovic/foo/trunk, development)
Testing parent:testapps:webserver
Compiling parent:testapps:webserver:test into /Users/petrovic/foo/trunk/testapps/webserver/target/test/classes
Running tests in parent:testapps:webserver
Trying to override old definition of datatype junit
    [junit] Testsuite: org.foo.embed.AppTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.064 sec
    [junit] 
    [junit] Testcase: testApp took 0.002 sec
Completed in 2.109s


2) Here's the test class:

package org.foo.embed;

import org.junit.Test;

import static org.junit.Assert.assertTrue;


public class AppTest {
    @Test
    public void testApp() {
        assertTrue(true);
    }
}


3) I'm using buildr 1.4.1:

$ buildr --version
Buildr 1.4.1


4) fwiw, when I grep junit in the output of the build I get

$ mini:trunk> buildr --trace test |grep junit
** Invoke /Users/petrovic/.m2/repository/junit/junit/4.7/junit-4.7.jar (first_time, not_needed)
** Invoke /Users/petrovic/.m2/repository/org/jmock/jmock-junit4/2.5.1/jmock-junit4-2.5.1.jar (first_time, not_needed)
** Invoke /Users/petrovic/.m2/repository/junit/junit/4.7/junit-4.7.jar (not_needed)
** Invoke /Users/petrovic/.m2/repository/org/jmock/jmock-junit4/2.5.1/jmock-junit4-2.5.1.jar (not_needed)

(Another tasteful Buildr choice:  log to stdout).


On Aug 28, 2010, at 11:03 AM, Antoine Toulme wrote:

> I committed a test ; I had to fix the current behavior which assumes junit4
> is in the classpath, so this functionality will be released with 1.4.2.
> 
> On Sat, Aug 28, 2010 at 10:10, Antoine Toulme <an...@lunar-ocean.com>wrote:
> 
>> Pointing out ? You can use junit3 for your project by changing your user
>> setting or in the Buildfile do:
>> 
>> Buildr.settings.build['junit'] = '3.8.1'
>> 
>> I guess I need to add a test for that :)
>> 
>> 
>> On Sat, Aug 28, 2010 at 10:00, Mark Petrovic <ms...@gmail.com> wrote:
>> 
>>> Yes, in fact, they are junit3 tests.  I should change them to junit4, but
>>> can buildr automate pointing out the condition?
>>> 
>>> 
>>> On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:
>>> 
>>>> I think it might be because of junit3 tests running in junit4. Are your
>>>> tests junit 3 tests ?
>>>> 
>>>> The junit4 runner must be the one logging this.
>>>> 
>>>> On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com>
>>> wrote:
>>>> 
>>>>> I'm seeing
>>>>> 
>>>>> "Trying to override old definition of datatype junit"
>>>>> 
>>>>> when I run tests on a certain project.  Appears to be the same issue as
>>>>> https://issues.apache.org/jira/browse/BUILDR-161.
>>>>> 
>>>>> What causes this?
>>>>> 
>>>>> --
>>>>> Mark Petrovic
>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
>>> --
>>> Mark Petrovic
>>> 
>>> 
>>> 
>> 


--
Mark Petrovic



Re: Trying to override old definition of datatype junit

Posted by Antoine Toulme <an...@lunar-ocean.com>.
No idea. I suggest you reopen BUILDR-161 with your test case, and we'll do
our best to fix the problem.

On Tue, Aug 31, 2010 at 07:32, Mark Petrovic <ms...@gmail.com> wrote:

> This is still a headscratcher, as the test in question has been converted
> to JUnit4:
>
> ... with --trace set in the invocation to buildr...
>
> Class org.apache.tools.ant.util.FileUtils loaded from parent loader
> (parentFirst)
> Could not load class
> (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for type junit
> Could not load class
> (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for type junit
> Trying to override old definition of datatype junit
>  +Datatype junit org.apache.tools.ant.taskdefs.optional.junit.JUnitTask
> ...
>
> where
>
> $  env |grep ANT_HOME
> ANT_HOME=/Users/petrovic/Ant/ant
>
> and
>
> $ jar tf $ANT_HOME/lib/ant-junit.jar |grep JUnitTask\.class
> org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.class
>
>
> I'll try to dig into the buildr 1.4.1 source to figure this out.
>
> Or, is this is expected behavior until the 1.4.2 release?  I thought it was
> only expected behavior if the tests were written for JUnit3.
>
>
> On Aug 28, 2010, at 11:03 AM, Antoine Toulme wrote:
>
> > I committed a test ; I had to fix the current behavior which assumes
> junit4
> > is in the classpath, so this functionality will be released with 1.4.2.
> >
> > On Sat, Aug 28, 2010 at 10:10, Antoine Toulme <antoine@lunar-ocean.com
> >wrote:
> >
> >> Pointing out ? You can use junit3 for your project by changing your user
> >> setting or in the Buildfile do:
> >>
> >> Buildr.settings.build['junit'] = '3.8.1'
> >>
> >> I guess I need to add a test for that :)
> >>
> >>
> >> On Sat, Aug 28, 2010 at 10:00, Mark Petrovic <ms...@gmail.com>
> wrote:
> >>
> >>> Yes, in fact, they are junit3 tests.  I should change them to junit4,
> but
> >>> can buildr automate pointing out the condition?
> >>>
> >>>
> >>> On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:
> >>>
> >>>> I think it might be because of junit3 tests running in junit4. Are
> your
> >>>> tests junit 3 tests ?
> >>>>
> >>>> The junit4 runner must be the one logging this.
> >>>>
> >>>> On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com>
> >>> wrote:
> >>>>
> >>>>> I'm seeing
> >>>>>
> >>>>> "Trying to override old definition of datatype junit"
> >>>>>
> >>>>> when I run tests on a certain project.  Appears to be the same issue
> as
> >>>>> https://issues.apache.org/jira/browse/BUILDR-161.
> >>>>>
> >>>>> What causes this?
> >>>>>
> >>>>> --
> >>>>> Mark Petrovic
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>> --
> >>> Mark Petrovic
> >>>
> >>>
> >>>
> >>
>
>

Re: Trying to override old definition of datatype junit

Posted by Mark Petrovic <ms...@gmail.com>.
This is still a headscratcher, as the test in question has been converted to JUnit4:

... with --trace set in the invocation to buildr...

Class org.apache.tools.ant.util.FileUtils loaded from parent loader (parentFirst)
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for type junit
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for type junit
Trying to override old definition of datatype junit
 +Datatype junit org.apache.tools.ant.taskdefs.optional.junit.JUnitTask
...

where 

$  env |grep ANT_HOME
ANT_HOME=/Users/petrovic/Ant/ant

and

$ jar tf $ANT_HOME/lib/ant-junit.jar |grep JUnitTask\.class
org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.class


I'll try to dig into the buildr 1.4.1 source to figure this out.

Or, is this is expected behavior until the 1.4.2 release?  I thought it was only expected behavior if the tests were written for JUnit3.


On Aug 28, 2010, at 11:03 AM, Antoine Toulme wrote:

> I committed a test ; I had to fix the current behavior which assumes junit4
> is in the classpath, so this functionality will be released with 1.4.2.
> 
> On Sat, Aug 28, 2010 at 10:10, Antoine Toulme <an...@lunar-ocean.com>wrote:
> 
>> Pointing out ? You can use junit3 for your project by changing your user
>> setting or in the Buildfile do:
>> 
>> Buildr.settings.build['junit'] = '3.8.1'
>> 
>> I guess I need to add a test for that :)
>> 
>> 
>> On Sat, Aug 28, 2010 at 10:00, Mark Petrovic <ms...@gmail.com> wrote:
>> 
>>> Yes, in fact, they are junit3 tests.  I should change them to junit4, but
>>> can buildr automate pointing out the condition?
>>> 
>>> 
>>> On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:
>>> 
>>>> I think it might be because of junit3 tests running in junit4. Are your
>>>> tests junit 3 tests ?
>>>> 
>>>> The junit4 runner must be the one logging this.
>>>> 
>>>> On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com>
>>> wrote:
>>>> 
>>>>> I'm seeing
>>>>> 
>>>>> "Trying to override old definition of datatype junit"
>>>>> 
>>>>> when I run tests on a certain project.  Appears to be the same issue as
>>>>> https://issues.apache.org/jira/browse/BUILDR-161.
>>>>> 
>>>>> What causes this?
>>>>> 
>>>>> --
>>>>> Mark Petrovic
>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
>>> --
>>> Mark Petrovic
>>> 
>>> 
>>> 
>> 


Re: Trying to override old definition of datatype junit

Posted by Antoine Toulme <an...@lunar-ocean.com>.
I committed a test ; I had to fix the current behavior which assumes junit4
is in the classpath, so this functionality will be released with 1.4.2.

On Sat, Aug 28, 2010 at 10:10, Antoine Toulme <an...@lunar-ocean.com>wrote:

> Pointing out ? You can use junit3 for your project by changing your user
> setting or in the Buildfile do:
>
> Buildr.settings.build['junit'] = '3.8.1'
>
> I guess I need to add a test for that :)
>
>
> On Sat, Aug 28, 2010 at 10:00, Mark Petrovic <ms...@gmail.com> wrote:
>
>> Yes, in fact, they are junit3 tests.  I should change them to junit4, but
>> can buildr automate pointing out the condition?
>>
>>
>> On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:
>>
>> > I think it might be because of junit3 tests running in junit4. Are your
>> > tests junit 3 tests ?
>> >
>> > The junit4 runner must be the one logging this.
>> >
>> > On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com>
>> wrote:
>> >
>> >> I'm seeing
>> >>
>> >> "Trying to override old definition of datatype junit"
>> >>
>> >> when I run tests on a certain project.  Appears to be the same issue as
>> >> https://issues.apache.org/jira/browse/BUILDR-161.
>> >>
>> >> What causes this?
>> >>
>> >> --
>> >> Mark Petrovic
>> >>
>> >>
>> >>
>>
>>
>> --
>> Mark Petrovic
>>
>>
>>
>

Re: Trying to override old definition of datatype junit

Posted by Antoine Toulme <an...@lunar-ocean.com>.
Pointing out ? You can use junit3 for your project by changing your user
setting or in the Buildfile do:

Buildr.settings.build['junit'] = '3.8.1'

I guess I need to add a test for that :)

On Sat, Aug 28, 2010 at 10:00, Mark Petrovic <ms...@gmail.com> wrote:

> Yes, in fact, they are junit3 tests.  I should change them to junit4, but
> can buildr automate pointing out the condition?
>
>
> On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:
>
> > I think it might be because of junit3 tests running in junit4. Are your
> > tests junit 3 tests ?
> >
> > The junit4 runner must be the one logging this.
> >
> > On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com>
> wrote:
> >
> >> I'm seeing
> >>
> >> "Trying to override old definition of datatype junit"
> >>
> >> when I run tests on a certain project.  Appears to be the same issue as
> >> https://issues.apache.org/jira/browse/BUILDR-161.
> >>
> >> What causes this?
> >>
> >> --
> >> Mark Petrovic
> >>
> >>
> >>
>
>
> --
> Mark Petrovic
>
>
>

Re: Trying to override old definition of datatype junit

Posted by Mark Petrovic <ms...@gmail.com>.
Yes, in fact, they are junit3 tests.  I should change them to junit4, but can buildr automate pointing out the condition?


On Aug 28, 2010, at 9:46 AM, Antoine Toulme wrote:

> I think it might be because of junit3 tests running in junit4. Are your
> tests junit 3 tests ?
> 
> The junit4 runner must be the one logging this.
> 
> On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com> wrote:
> 
>> I'm seeing
>> 
>> "Trying to override old definition of datatype junit"
>> 
>> when I run tests on a certain project.  Appears to be the same issue as
>> https://issues.apache.org/jira/browse/BUILDR-161.
>> 
>> What causes this?
>> 
>> --
>> Mark Petrovic
>> 
>> 
>> 


--
Mark Petrovic



Re: Trying to override old definition of datatype junit

Posted by Antoine Toulme <an...@lunar-ocean.com>.
I think it might be because of junit3 tests running in junit4. Are your
tests junit 3 tests ?

The junit4 runner must be the one logging this.

On Sat, Aug 28, 2010 at 07:17, Mark Petrovic <ms...@gmail.com> wrote:

> I'm seeing
>
> "Trying to override old definition of datatype junit"
>
> when I run tests on a certain project.  Appears to be the same issue as
> https://issues.apache.org/jira/browse/BUILDR-161.
>
> What causes this?
>
> --
> Mark Petrovic
>
>
>