You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by CheapLisa <li...@purpleblade.net> on 2008/12/10 06:16:39 UTC

Is Maven / JUnit 4.x broken (annotations)

I have JUnit 4.5 as a dependency in my maven pom
and I have imported annotations into my test case but
it is not recognizing the @Test and @Ignore annotations.

I still have to preface the method name with "test"
and the @Ignore tests get executed.

Is something broken?  What do I need to do to get this
to work like expected and to take advantage of JUnit 4.x
which has over a year of release now.


thanks

Lisa
-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
What is the name of your test?

L


Anders Hammar wrote:
> 
> Hi,
> 
> Just tried it and it works for me, both in Eclipse and from command
> prompt.
> How are you executing?
> 
> /Anders
> 
> 
> CheapLisa wrote:
>> 
>> I have JUnit 4.5 as a dependency in my maven pom
>> and I have imported annotations into my test case but
>> it is not recognizing the @Test and @Ignore annotations.
>> 
>> I still have to preface the method name with "test"
>> and the @Ignore tests get executed.
>> 
>> Is something broken?  What do I need to do to get this
>> to work like expected and to take advantage of JUnit 4.x
>> which has over a year of release now.
>> 
>> 
>> thanks
>> 
>> Lisa
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943448.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Is Maven / JUnit 4.x broken (annotations)

Posted by Anders Hammar <an...@hammar.net>.
Ok, that could be the problem as I think Lisa said she extends TestCase.
Lisa, please try removing that!

/A

justinedelson wrote:
> 
> I seem to recall a problem where if you tried to combine JUnit 3.x and 4.x
> styles (i.e. use annotation and extend TestCase), something like the below
> would happen. But I'm not sure that was a Maven problem.
>  
> Justin
> 
> ________________________________
> 
> From: Anders Hammar [mailto:anders@hammar.net]
> Sent: Wed 12/10/2008 6:31 AM
> To: users@maven.apache.org
> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
> 
> 
> 
> 
> Hi,
> 
> Just tried it and it works for me, both in Eclipse and from command
> prompt.
> How are you executing?
> 
> /Anders
> 
> 
> CheapLisa wrote:
>>
>> I have JUnit 4.5 as a dependency in my maven pom
>> and I have imported annotations into my test case but
>> it is not recognizing the @Test and @Ignore annotations.
>>
>> I still have to preface the method name with "test"
>> and the @Ignore tests get executed.
>>
>> Is something broken?  What do I need to do to get this
>> to work like expected and to take advantage of JUnit 4.x
>> which has over a year of release now.
>>
>>
>> thanks
>>
>> Lisa
>>
> 
> --
> View this message in context:
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20933525.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964774.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Is Maven / JUnit 4.x broken (annotations)

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
I seem to recall a problem where if you tried to combine JUnit 3.x and 4.x styles (i.e. use annotation and extend TestCase), something like the below would happen. But I'm not sure that was a Maven problem.
 
Justin

________________________________

From: Anders Hammar [mailto:anders@hammar.net]
Sent: Wed 12/10/2008 6:31 AM
To: users@maven.apache.org
Subject: Re: Is Maven / JUnit 4.x broken (annotations)




Hi,

Just tried it and it works for me, both in Eclipse and from command prompt.
How are you executing?

/Anders


CheapLisa wrote:
>
> I have JUnit 4.5 as a dependency in my maven pom
> and I have imported annotations into my test case but
> it is not recognizing the @Test and @Ignore annotations.
>
> I still have to preface the method name with "test"
> and the @Ignore tests get executed.
>
> Is something broken?  What do I need to do to get this
> to work like expected and to take advantage of JUnit 4.x
> which has over a year of release now.
>
>
> thanks
>
> Lisa
>

--
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20933525.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Anders Hammar <an...@hammar.net>.
Hi,

Just tried it and it works for me, both in Eclipse and from command prompt.
How are you executing?

/Anders


CheapLisa wrote:
> 
> I have JUnit 4.5 as a dependency in my maven pom
> and I have imported annotations into my test case but
> it is not recognizing the @Test and @Ignore annotations.
> 
> I still have to preface the method name with "test"
> and the @Ignore tests get executed.
> 
> Is something broken?  What do I need to do to get this
> to work like expected and to take advantage of JUnit 4.x
> which has over a year of release now.
> 
> 
> thanks
> 
> Lisa
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20933525.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Anders Hammar <an...@hammar.net>.
Eclipse is a major IDE. Please google!

If you want to use the default surefire plugin configuration you MUST name
your test class according to the default configuration for the surefire
plugin. Please see link provided earlier. If not, you need to configure the
surefire plugin yourself (see link provided in some other answer).

Btw, for JUnit 4.x you should NOT extend TestCase!

Please execute your JUnit 4.x test class in your IDE. Does it work? If not,
something is wrong with your class (or your IDE is misconfigred). If yes,
then your problem is the maven configuration (configuration of the surefire
plugin).

/Anders


CheapLisa wrote:
> 
> What's Eclipse?
> 
> Also JUnit4 annotations have  no restrictions on file nameing if
> annotations are used.  I simply want
> to use the JUnit4 features and not name my files the JUnit 3.x way.
> 
> L
> 
> 
> 
> Anders Hammar wrote:
>> 
>> Or "*Test.java", or "*TestCase.java". That's the names surefire is
>> configured for by default.
>> (http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes)
>> I would suggest trying it in Eclipse first. If it works there, then there
>> is some configuration issue for Maven.
>> 
>> /Anders
>> 
>> 
>> Josh Suereth wrote:
>>> 
>>> I believe the name of  the class still matters.  Try calling it
>>> "Test*.java"
>>> 
>>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
>>> wrote:
>>> 
>>>>
>>>> I have JUnit 4.5 as a dependency in my maven pom
>>>> and I have imported annotations into my test case but
>>>> it is not recognizing the @Test and @Ignore annotations.
>>>>
>>>> I still have to preface the method name with "test"
>>>> and the @Ignore tests get executed.
>>>>
>>>> Is something broken?  What do I need to do to get this
>>>> to work like expected and to take advantage of JUnit 4.x
>>>> which has over a year of release now.
>>>>
>>>>
>>>> thanks
>>>>
>>>> Lisa
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964773.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
What's Eclipse?

Also JUnit4 annotations have  no restrictions on file nameing if annotations
are used.  I simply want
to use the JUnit4 features and not name my files the JUnit 3.x way.

L



Anders Hammar wrote:
> 
> Or "*Test.java", or "*TestCase.java". That's the names surefire is
> configured for by default.
> (http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes)
> I would suggest trying it in Eclipse first. If it works there, then there
> is some configuration issue for Maven.
> 
> /Anders
> 
> 
> Josh Suereth wrote:
>> 
>> I believe the name of  the class still matters.  Try calling it
>> "Test*.java"
>> 
>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
>> 
>>>
>>> I have JUnit 4.5 as a dependency in my maven pom
>>> and I have imported annotations into my test case but
>>> it is not recognizing the @Test and @Ignore annotations.
>>>
>>> I still have to preface the method name with "test"
>>> and the @Ignore tests get executed.
>>>
>>> Is something broken?  What do I need to do to get this
>>> to work like expected and to take advantage of JUnit 4.x
>>> which has over a year of release now.
>>>
>>>
>>> thanks
>>>
>>> Lisa
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943447.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I can get my tests to execute if the class name ends in Test.java and only if
the method begins
with "testSomeMethod".

otherwise the test will not run.  I should be able to name the class
anything I want (not include "Test"), extend TestCase and name the method
anything I want as long as there is an @Test annotation there.

Also I would like to use the @Ignore annotation.

Is Maven broken when it comes to running Junit4 annotations?

thanks


L



Anders Hammar wrote:
> 
> Or "*Test.java", or "*TestCase.java". That's the names surefire is
> configured for by default.
> (http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes)
> I would suggest trying it in Eclipse first. If it works there, then there
> is some configuration issue for Maven.
> 
> /Anders
> 
> 
> Josh Suereth wrote:
>> 
>> I believe the name of  the class still matters.  Try calling it
>> "Test*.java"
>> 
>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
>> 
>>>
>>> I have JUnit 4.5 as a dependency in my maven pom
>>> and I have imported annotations into my test case but
>>> it is not recognizing the @Test and @Ignore annotations.
>>>
>>> I still have to preface the method name with "test"
>>> and the @Ignore tests get executed.
>>>
>>> Is something broken?  What do I need to do to get this
>>> to work like expected and to take advantage of JUnit 4.x
>>> which has over a year of release now.
>>>
>>>
>>> thanks
>>>
>>> Lisa
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943507.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


AW: Is Maven / JUnit 4.x broken (annotations)

Posted by "Rouvinez, Jean-Claude" <Je...@ipi.ch>.
Hi,

I tested it this way:
Configuration:
  Maven version: 2.0.9
  Java version: 1.5.0_09
  OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

  1). I renamed my test class from ServiceTest to ServiceXxx
      I run
       mvn clean install
      ==> The file was ignored

  2). I renamed my test class from ServiceXxx to ServiceTest
      All test methods in the file have the form:
        @Test
        public void noNameGetPersonByNameNoPerson() throws Exception
      I run
       mvn clean install
      ==> All tests were executed

==> The test file must be named according to 
    http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes

==> The test methods don't have to follow any convention. 
    Only the annotation @Test is necessary.

Best Regards.
Jean-Claude

-----Ursprüngliche Nachricht-----
Von: Anders Hammar [mailto:anders@hammar.net] 
Gesendet: Mittwoch, 10. Dezember 2008 14:06
An: users@maven.apache.org
Betreff: Re: Is Maven / JUnit 4.x broken (annotations)


Or "*Test.java", or "*TestCase.java". That's the names surefire is configured
for by default.
(http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes)
I would suggest trying it in Eclipse first. If it works there, then there is
some configuration issue for Maven.

/Anders


Josh Suereth wrote:
> 
> I believe the name of  the class still matters.  Try calling it
> "Test*.java"
> 
> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
> 
>>
>> I have JUnit 4.5 as a dependency in my maven pom
>> and I have imported annotations into my test case but
>> it is not recognizing the @Test and @Ignore annotations.
>>
>> I still have to preface the method name with "test"
>> and the @Ignore tests get executed.
>>
>> Is something broken?  What do I need to do to get this
>> to work like expected and to take advantage of JUnit 4.x
>> which has over a year of release now.
>>
>>
>> thanks
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20934997.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Anders Hammar <an...@hammar.net>.
Or "*Test.java", or "*TestCase.java". That's the names surefire is configured
for by default.
(http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#includes)
I would suggest trying it in Eclipse first. If it works there, then there is
some configuration issue for Maven.

/Anders


Josh Suereth wrote:
> 
> I believe the name of  the class still matters.  Try calling it
> "Test*.java"
> 
> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
> 
>>
>> I have JUnit 4.5 as a dependency in my maven pom
>> and I have imported annotations into my test case but
>> it is not recognizing the @Test and @Ignore annotations.
>>
>> I still have to preface the method name with "test"
>> and the @Ignore tests get executed.
>>
>> Is something broken?  What do I need to do to get this
>> to work like expected and to take advantage of JUnit 4.x
>> which has over a year of release now.
>>
>>
>> thanks
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20934997.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I did this.  and if you do it, you will see no reference to surefire other
than surefire in the reporting section.

thanks


cl



Josh Suereth wrote:
> 
> Also to follow that up,
> 
> Although you didn't specify the maven-surefire-plugin, your build file has
> inherited it from the ethereal "maven super pom".
> 
> Type mvn help:effective-pom to see what your pom *really* looks like, so
> you
> can get an idea of how/what to configure for surefire.
> 
> On Thu, Dec 11, 2008 at 7:46 PM, Josh Suereth
> <jo...@gmail.com>wrote:
> 
>> Lisa,
>>
>>
>> The answer is that although Junit4 might support finding the @Test
>> annotations, the maven surefire plugin (being backwards compatable, AND a
>> completely different tool) looks for Test* *Test and *TestSuite.   You
>> need
>> to configure the maven-surefire-plugin (This is the part of maven that
>> calls
>> into junit) for junit4 conventions, or you won't get your desired
>> behavior.
>>
>> -Josh
>>
>>
>> On Thu, Dec 11, 2008 at 6:39 PM, CheapLisa <li...@purpleblade.net> wrote:
>>
>>>
>>> I do not believe this has anything to do with it and I don't understand
>>> what
>>> you are saying.
>>>
>>> L
>>>
>>>
>>>
>>> mgainty wrote:
>>> >
>>> >
>>> > place the groupId/artifactId/version in the dependencies in
>>> > dependencyManagement Section of the parent pom
>>> > <project>
>>> >   ...
>>> >   <dependencyManagement>
>>> >     <dependencies>
>>> >       <dependency>
>>> >         <groupId>group-a</groupId>
>>> >         <artifactId>artifact-a</artifactId>
>>> >         <version>1.0</version>
>>> >
>>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>>> >
>>> > hth
>>> > Martin
>>> > ______________________________________________
>>> > Disclaimer and confidentiality note
>>> > Everything in this e-mail and any attachments relates to the official
>>> > business of Sender. This transmission is of a confidential nature and
>>> > Sender does not endorse distribution to any party other than intended
>>> > recipient. Sender does not necessarily endorse content contained
>>> within
>>> > this transmission.
>>> >
>>> >
>>> >
>>> >
>>> >> Date: Wed, 10 Dec 2008 12:44:45 -0800
>>> >> From: lisa@purpleblade.net
>>> >> To: users@maven.apache.org
>>> >> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
>>> >>
>>> >>
>>> >> I looked at my effective pom.  I have a dependency there on JUnit
>>> 4.5.
>>> >> The only reference to surefire was maven-surefire-reports-plugin in
>>> the
>>> >> reporting section.
>>> >>
>>> >> how do I know that surefire is using my dependency of JUnit 4.5?  Is
>>> >> maven
>>> >> bundled with another version of JUnit and using an earlier version
>>> that
>>> >> I'm
>>> >> not aware of?
>>> >>
>>> >> How do I force the surefire plugin to use JUnit 4.5?
>>> >>
>>> >> thanks
>>> >>
>>> >> L
>>> >>
>>> >>
>>> >>
>>> >> John Stoneham wrote:
>>> >> >
>>> >> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa
>>> <li...@purpleblade.net>
>>> >> >>> wrote:
>>> >> >>>> I have JUnit 4.5 as a dependency in my maven pom
>>> >> >>>> and I have imported annotations into my test case but
>>> >> >>>> it is not recognizing the @Test and @Ignore annotations.
>>> >> >>>>
>>> >> >>>> I still have to preface the method name with "test"
>>> >> >>>> and the @Ignore tests get executed.
>>> >> >>>>
>>> >> >>>> Is something broken?  What do I need to do to get this
>>> >> >>>> to work like expected and to take advantage of JUnit 4.x
>>> >> >>>> which has over a year of release now.
>>> >> >
>>> >> > Hm. Last time this happened to me it was because I was trying to
>>> >> > repackage JUnit with a bunch of other things, and it turned out
>>> >> > surefire was inspecting my POM to look for a junit:junit
>>> dependency,
>>> >> > then pulling the version off that to determine whether to look for
>>> >> > JUnit 4 tests.
>>> >> >
>>> >> > Sounds to me like surefire thinks your JUnit dependency is version
>>> 3.
>>> >> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
>>> >> > tests properly.
>>> >> >
>>> >> > Is it possible to post the output of mvn help:effective-pom here?
>>> >> >
>>> >> > - John
>>> >> >
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> >> > For additional commands, e-mail: users-help@maven.apache.org
>>> >> >
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
>>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> >> For additional commands, e-mail: users-help@maven.apache.org
>>> >>
>>> >
>>> > _________________________________________________________________
>>> > Send e-mail faster without improving your typing skills.
>>> >
>>> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964992.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20987228.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Josh Suereth <jo...@gmail.com>.
Also to follow that up,

Although you didn't specify the maven-surefire-plugin, your build file has
inherited it from the ethereal "maven super pom".

Type mvn help:effective-pom to see what your pom *really* looks like, so you
can get an idea of how/what to configure for surefire.

On Thu, Dec 11, 2008 at 7:46 PM, Josh Suereth <jo...@gmail.com>wrote:

> Lisa,
>
>
> The answer is that although Junit4 might support finding the @Test
> annotations, the maven surefire plugin (being backwards compatable, AND a
> completely different tool) looks for Test* *Test and *TestSuite.   You need
> to configure the maven-surefire-plugin (This is the part of maven that calls
> into junit) for junit4 conventions, or you won't get your desired behavior.
>
> -Josh
>
>
> On Thu, Dec 11, 2008 at 6:39 PM, CheapLisa <li...@purpleblade.net> wrote:
>
>>
>> I do not believe this has anything to do with it and I don't understand
>> what
>> you are saying.
>>
>> L
>>
>>
>>
>> mgainty wrote:
>> >
>> >
>> > place the groupId/artifactId/version in the dependencies in
>> > dependencyManagement Section of the parent pom
>> > <project>
>> >   ...
>> >   <dependencyManagement>
>> >     <dependencies>
>> >       <dependency>
>> >         <groupId>group-a</groupId>
>> >         <artifactId>artifact-a</artifactId>
>> >         <version>1.0</version>
>> >
>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>> >
>> > hth
>> > Martin
>> > ______________________________________________
>> > Disclaimer and confidentiality note
>> > Everything in this e-mail and any attachments relates to the official
>> > business of Sender. This transmission is of a confidential nature and
>> > Sender does not endorse distribution to any party other than intended
>> > recipient. Sender does not necessarily endorse content contained within
>> > this transmission.
>> >
>> >
>> >
>> >
>> >> Date: Wed, 10 Dec 2008 12:44:45 -0800
>> >> From: lisa@purpleblade.net
>> >> To: users@maven.apache.org
>> >> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
>> >>
>> >>
>> >> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
>> >> The only reference to surefire was maven-surefire-reports-plugin in the
>> >> reporting section.
>> >>
>> >> how do I know that surefire is using my dependency of JUnit 4.5?  Is
>> >> maven
>> >> bundled with another version of JUnit and using an earlier version that
>> >> I'm
>> >> not aware of?
>> >>
>> >> How do I force the surefire plugin to use JUnit 4.5?
>> >>
>> >> thanks
>> >>
>> >> L
>> >>
>> >>
>> >>
>> >> John Stoneham wrote:
>> >> >
>> >> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
>> >> >>> wrote:
>> >> >>>> I have JUnit 4.5 as a dependency in my maven pom
>> >> >>>> and I have imported annotations into my test case but
>> >> >>>> it is not recognizing the @Test and @Ignore annotations.
>> >> >>>>
>> >> >>>> I still have to preface the method name with "test"
>> >> >>>> and the @Ignore tests get executed.
>> >> >>>>
>> >> >>>> Is something broken?  What do I need to do to get this
>> >> >>>> to work like expected and to take advantage of JUnit 4.x
>> >> >>>> which has over a year of release now.
>> >> >
>> >> > Hm. Last time this happened to me it was because I was trying to
>> >> > repackage JUnit with a bunch of other things, and it turned out
>> >> > surefire was inspecting my POM to look for a junit:junit dependency,
>> >> > then pulling the version off that to determine whether to look for
>> >> > JUnit 4 tests.
>> >> >
>> >> > Sounds to me like surefire thinks your JUnit dependency is version 3.
>> >> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
>> >> > tests properly.
>> >> >
>> >> > Is it possible to post the output of mvn help:effective-pom here?
>> >> >
>> >> > - John
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> > For additional commands, e-mail: users-help@maven.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >
>> > _________________________________________________________________
>> > Send e-mail faster without improving your typing skills.
>> >
>> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964992.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Josh Suereth <jo...@gmail.com>.
Lisa,


The answer is that although Junit4 might support finding the @Test
annotations, the maven surefire plugin (being backwards compatable, AND a
completely different tool) looks for Test* *Test and *TestSuite.   You need
to configure the maven-surefire-plugin (This is the part of maven that calls
into junit) for junit4 conventions, or you won't get your desired behavior.

-Josh

On Thu, Dec 11, 2008 at 6:39 PM, CheapLisa <li...@purpleblade.net> wrote:

>
> I do not believe this has anything to do with it and I don't understand
> what
> you are saying.
>
> L
>
>
>
> mgainty wrote:
> >
> >
> > place the groupId/artifactId/version in the dependencies in
> > dependencyManagement Section of the parent pom
> > <project>
> >   ...
> >   <dependencyManagement>
> >     <dependencies>
> >       <dependency>
> >         <groupId>group-a</groupId>
> >         <artifactId>artifact-a</artifactId>
> >         <version>1.0</version>
> >
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> >
> > hth
> > Martin
> > ______________________________________________
> > Disclaimer and confidentiality note
> > Everything in this e-mail and any attachments relates to the official
> > business of Sender. This transmission is of a confidential nature and
> > Sender does not endorse distribution to any party other than intended
> > recipient. Sender does not necessarily endorse content contained within
> > this transmission.
> >
> >
> >
> >
> >> Date: Wed, 10 Dec 2008 12:44:45 -0800
> >> From: lisa@purpleblade.net
> >> To: users@maven.apache.org
> >> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
> >>
> >>
> >> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
> >> The only reference to surefire was maven-surefire-reports-plugin in the
> >> reporting section.
> >>
> >> how do I know that surefire is using my dependency of JUnit 4.5?  Is
> >> maven
> >> bundled with another version of JUnit and using an earlier version that
> >> I'm
> >> not aware of?
> >>
> >> How do I force the surefire plugin to use JUnit 4.5?
> >>
> >> thanks
> >>
> >> L
> >>
> >>
> >>
> >> John Stoneham wrote:
> >> >
> >> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
> >> >>> wrote:
> >> >>>> I have JUnit 4.5 as a dependency in my maven pom
> >> >>>> and I have imported annotations into my test case but
> >> >>>> it is not recognizing the @Test and @Ignore annotations.
> >> >>>>
> >> >>>> I still have to preface the method name with "test"
> >> >>>> and the @Ignore tests get executed.
> >> >>>>
> >> >>>> Is something broken?  What do I need to do to get this
> >> >>>> to work like expected and to take advantage of JUnit 4.x
> >> >>>> which has over a year of release now.
> >> >
> >> > Hm. Last time this happened to me it was because I was trying to
> >> > repackage JUnit with a bunch of other things, and it turned out
> >> > surefire was inspecting my POM to look for a junit:junit dependency,
> >> > then pulling the version off that to determine whether to look for
> >> > JUnit 4 tests.
> >> >
> >> > Sounds to me like surefire thinks your JUnit dependency is version 3.
> >> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
> >> > tests properly.
> >> >
> >> > Is it possible to post the output of mvn help:effective-pom here?
> >> >
> >> > - John
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >
> > _________________________________________________________________
> > Send e-mail faster without improving your typing skills.
> >
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> >
>
> --
> View this message in context:
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964992.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I do not believe this has anything to do with it and I don't understand what
you are saying.

L



mgainty wrote:
> 
> 
> place the groupId/artifactId/version in the dependencies in
> dependencyManagement Section of the parent pom
> <project>
>   ...
>   <dependencyManagement>
>     <dependencies>
>       <dependency>
>         <groupId>group-a</groupId>
>         <artifactId>artifact-a</artifactId>
>         <version>1.0</version>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> 
> hth
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission. 
> 
> 
> 
> 
>> Date: Wed, 10 Dec 2008 12:44:45 -0800
>> From: lisa@purpleblade.net
>> To: users@maven.apache.org
>> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
>> 
>> 
>> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
>> The only reference to surefire was maven-surefire-reports-plugin in the
>> reporting section.
>> 
>> how do I know that surefire is using my dependency of JUnit 4.5?  Is
>> maven
>> bundled with another version of JUnit and using an earlier version that
>> I'm
>> not aware of?
>> 
>> How do I force the surefire plugin to use JUnit 4.5?
>> 
>> thanks
>> 
>> L
>> 
>> 
>> 
>> John Stoneham wrote:
>> > 
>> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
>> >>> wrote:
>> >>>> I have JUnit 4.5 as a dependency in my maven pom
>> >>>> and I have imported annotations into my test case but
>> >>>> it is not recognizing the @Test and @Ignore annotations.
>> >>>>
>> >>>> I still have to preface the method name with "test"
>> >>>> and the @Ignore tests get executed.
>> >>>>
>> >>>> Is something broken?  What do I need to do to get this
>> >>>> to work like expected and to take advantage of JUnit 4.x
>> >>>> which has over a year of release now.
>> > 
>> > Hm. Last time this happened to me it was because I was trying to
>> > repackage JUnit with a bunch of other things, and it turned out
>> > surefire was inspecting my POM to look for a junit:junit dependency,
>> > then pulling the version off that to determine whether to look for
>> > JUnit 4 tests.
>> > 
>> > Sounds to me like surefire thinks your JUnit dependency is version 3.
>> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
>> > tests properly.
>> > 
>> > Is it possible to post the output of mvn help:effective-pom here?
>> > 
>> > - John
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
> 
> _________________________________________________________________
> Send e-mail faster without improving your typing skills.
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20964992.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Wayne Fay <wa...@gmail.com>.
> I think you don't get the point. By detection we mean that given a base
> directory, Surefire will find all test classes beneath it, w/o us having to
> adhere to any naming convention. Surefire can't do this.

I agree with one small edit -- Surefire can't do this *today*. If this
is important enough to someone, feel free to add some code, contribute
it back, and Surefire could arguably support it in the future.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Peter Niederwieser <pn...@gmail.com>.

John Stoneham wrote:
> 
> To be clearer - surefire will certainly detect JUnit 4 tests
> 

I think you don't get the point. By detection we mean that given a base
directory, Surefire will find all test classes beneath it, w/o us having to
adhere to any naming convention. Surefire can't do this.

Cheers,
Peter

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p21019558.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by John Stoneham <ly...@lyrically.net>.
On Mon, Dec 15, 2008 at 11:12 AM, Peter Niederwieser <pn...@gmail.com> wrote:
>> What you are saying is that the surefire plugin is not JUnit4 enabled?
>
> Unfortunately, Surefire isn't capable of detecting JUnit 4 tests by itself.
> You always have to adhere to some naming convention.

To be clearer - surefire will certainly detect JUnit 4 tests, but:

1) It will only search for JUnit tests if your project has a
dependency on junit:junit 4.x (this is hardcoded, but there is some
relaxation of rules for a few other scenarios - I don't know where
this is documented)

2) By default, it will only examine the following classes for JUnit 4 tests:
    - **/Test*.java
    - **/*Test.java
    - **/*TestCase.java
This is documented at
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html.
That page also contains an example of the syntax for changing the set
of classes that are included or excluded from examination.

- John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Is Maven / JUnit 4.x broken (annotations)

Posted by Peter Niederwieser <pn...@gmail.com>.

CheapLisa wrote:
> 
> What you are saying is that the surefire plugin is not JUnit4 enabled?
> 

Unfortunately, Surefire isn't capable of detecting JUnit 4 tests by itself.
You always have to adhere to some naming convention.

Cheers,
Peter
-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p21016664.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Josh Suereth <jo...@gmail.com>.
What I'm saying is that the surefire plugin is responsible for bootstrapping
Junit4, but does not follow all of its conventions.  It has its own
conventions.  If you want to use Junit4 in maven, that means you use
surefire to call into Junit4.   If you don't like the default configuration
for the surefire plugin, feel free to override it in a parent pom (and all
your children will make use of it).

Here's the relevant section of the surefire plugin website:
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

On Fri, Dec 12, 2008 at 11:02 PM, CheapLisa <li...@purpleblade.net> wrote:

>
> What does group-a and artifact-a refer to?
>
> so I have to do this in every pom in every sub-module?  Is there anything I
> can do in the top level pom that will take care of the whole project?
>
> What you are saying is that the surefire plugin is not JUnit4 enabled?
>
> thanks
>
> CL
>
>
>
> mgainty wrote:
> >
> >
> > place the groupId/artifactId/version in the dependencies in
> > dependencyManagement Section of the parent pom
> > <project>
> >   ...
> >   <dependencyManagement>
> >     <dependencies>
> >       <dependency>
> >         <groupId>group-a</groupId>
> >         <artifactId>artifact-a</artifactId>
> >         <version>1.0</version>
> >
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> >
> > hth
> > Martin
> > ______________________________________________
> > Disclaimer and confidentiality note
> > Everything in this e-mail and any attachments relates to the official
> > business of Sender. This transmission is of a confidential nature and
> > Sender does not endorse distribution to any party other than intended
> > recipient. Sender does not necessarily endorse content contained within
> > this transmission.
> >
> >
> >
> >
> >> Date: Wed, 10 Dec 2008 12:44:45 -0800
> >> From: lisa@purpleblade.net
> >> To: users@maven.apache.org
> >> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
> >>
> >>
> >> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
> >> The only reference to surefire was maven-surefire-reports-plugin in the
> >> reporting section.
> >>
> >> how do I know that surefire is using my dependency of JUnit 4.5?  Is
> >> maven
> >> bundled with another version of JUnit and using an earlier version that
> >> I'm
> >> not aware of?
> >>
> >> How do I force the surefire plugin to use JUnit 4.5?
> >>
> >> thanks
> >>
> >> L
> >>
> >>
> >>
> >> John Stoneham wrote:
> >> >
> >> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
> >> >>> wrote:
> >> >>>> I have JUnit 4.5 as a dependency in my maven pom
> >> >>>> and I have imported annotations into my test case but
> >> >>>> it is not recognizing the @Test and @Ignore annotations.
> >> >>>>
> >> >>>> I still have to preface the method name with "test"
> >> >>>> and the @Ignore tests get executed.
> >> >>>>
> >> >>>> Is something broken?  What do I need to do to get this
> >> >>>> to work like expected and to take advantage of JUnit 4.x
> >> >>>> which has over a year of release now.
> >> >
> >> > Hm. Last time this happened to me it was because I was trying to
> >> > repackage JUnit with a bunch of other things, and it turned out
> >> > surefire was inspecting my POM to look for a junit:junit dependency,
> >> > then pulling the version off that to determine whether to look for
> >> > JUnit 4 tests.
> >> >
> >> > Sounds to me like surefire thinks your JUnit dependency is version 3.
> >> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
> >> > tests properly.
> >> >
> >> > Is it possible to post the output of mvn help:effective-pom here?
> >> >
> >> > - John
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >
> > _________________________________________________________________
> > Send e-mail faster without improving your typing skills.
> >
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> >
>
> --
> View this message in context:
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20987238.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
What does group-a and artifact-a refer to?

so I have to do this in every pom in every sub-module?  Is there anything I
can do in the top level pom that will take care of the whole project?

What you are saying is that the surefire plugin is not JUnit4 enabled?

thanks

CL



mgainty wrote:
> 
> 
> place the groupId/artifactId/version in the dependencies in
> dependencyManagement Section of the parent pom
> <project>
>   ...
>   <dependencyManagement>
>     <dependencies>
>       <dependency>
>         <groupId>group-a</groupId>
>         <artifactId>artifact-a</artifactId>
>         <version>1.0</version>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> 
> hth
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission. 
> 
> 
> 
> 
>> Date: Wed, 10 Dec 2008 12:44:45 -0800
>> From: lisa@purpleblade.net
>> To: users@maven.apache.org
>> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
>> 
>> 
>> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
>> The only reference to surefire was maven-surefire-reports-plugin in the
>> reporting section.
>> 
>> how do I know that surefire is using my dependency of JUnit 4.5?  Is
>> maven
>> bundled with another version of JUnit and using an earlier version that
>> I'm
>> not aware of?
>> 
>> How do I force the surefire plugin to use JUnit 4.5?
>> 
>> thanks
>> 
>> L
>> 
>> 
>> 
>> John Stoneham wrote:
>> > 
>> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
>> >>> wrote:
>> >>>> I have JUnit 4.5 as a dependency in my maven pom
>> >>>> and I have imported annotations into my test case but
>> >>>> it is not recognizing the @Test and @Ignore annotations.
>> >>>>
>> >>>> I still have to preface the method name with "test"
>> >>>> and the @Ignore tests get executed.
>> >>>>
>> >>>> Is something broken?  What do I need to do to get this
>> >>>> to work like expected and to take advantage of JUnit 4.x
>> >>>> which has over a year of release now.
>> > 
>> > Hm. Last time this happened to me it was because I was trying to
>> > repackage JUnit with a bunch of other things, and it turned out
>> > surefire was inspecting my POM to look for a junit:junit dependency,
>> > then pulling the version off that to determine whether to look for
>> > JUnit 4 tests.
>> > 
>> > Sounds to me like surefire thinks your JUnit dependency is version 3.
>> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
>> > tests properly.
>> > 
>> > Is it possible to post the output of mvn help:effective-pom here?
>> > 
>> > - John
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
> 
> _________________________________________________________________
> Send e-mail faster without improving your typing skills.
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20987238.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Is Maven / JUnit 4.x broken (annotations)

Posted by Martin Gainty <mg...@hotmail.com>.
place the groupId/artifactId/version in the dependencies in dependencyManagement Section of the parent pom
<project>
  ...
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>group-a</groupId>
        <artifactId>artifact-a</artifactId>
        <version>1.0</version>
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

hth
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Wed, 10 Dec 2008 12:44:45 -0800
> From: lisa@purpleblade.net
> To: users@maven.apache.org
> Subject: Re: Is Maven / JUnit 4.x broken (annotations)
> 
> 
> I looked at my effective pom.  I have a dependency there on JUnit 4.5.
> The only reference to surefire was maven-surefire-reports-plugin in the
> reporting section.
> 
> how do I know that surefire is using my dependency of JUnit 4.5?  Is maven
> bundled with another version of JUnit and using an earlier version that I'm
> not aware of?
> 
> How do I force the surefire plugin to use JUnit 4.5?
> 
> thanks
> 
> L
> 
> 
> 
> John Stoneham wrote:
> > 
> >>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
> >>> wrote:
> >>>> I have JUnit 4.5 as a dependency in my maven pom
> >>>> and I have imported annotations into my test case but
> >>>> it is not recognizing the @Test and @Ignore annotations.
> >>>>
> >>>> I still have to preface the method name with "test"
> >>>> and the @Ignore tests get executed.
> >>>>
> >>>> Is something broken?  What do I need to do to get this
> >>>> to work like expected and to take advantage of JUnit 4.x
> >>>> which has over a year of release now.
> > 
> > Hm. Last time this happened to me it was because I was trying to
> > repackage JUnit with a bunch of other things, and it turned out
> > surefire was inspecting my POM to look for a junit:junit dependency,
> > then pulling the version off that to determine whether to look for
> > JUnit 4 tests.
> > 
> > Sounds to me like surefire thinks your JUnit dependency is version 3.
> > We've got JUnit 4.4 configured here and it runs both 3- and 4-style
> > tests properly.
> > 
> > Is it possible to post the output of mvn help:effective-pom here?
> > 
> > - John
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008

Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I looked at my effective pom.  I have a dependency there on JUnit 4.5.
The only reference to surefire was maven-surefire-reports-plugin in the
reporting section.

how do I know that surefire is using my dependency of JUnit 4.5?  Is maven
bundled with another version of JUnit and using an earlier version that I'm
not aware of?

How do I force the surefire plugin to use JUnit 4.5?

thanks

L



John Stoneham wrote:
> 
>>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net>
>>> wrote:
>>>> I have JUnit 4.5 as a dependency in my maven pom
>>>> and I have imported annotations into my test case but
>>>> it is not recognizing the @Test and @Ignore annotations.
>>>>
>>>> I still have to preface the method name with "test"
>>>> and the @Ignore tests get executed.
>>>>
>>>> Is something broken?  What do I need to do to get this
>>>> to work like expected and to take advantage of JUnit 4.x
>>>> which has over a year of release now.
> 
> Hm. Last time this happened to me it was because I was trying to
> repackage JUnit with a bunch of other things, and it turned out
> surefire was inspecting my POM to look for a junit:junit dependency,
> then pulling the version off that to determine whether to look for
> JUnit 4 tests.
> 
> Sounds to me like surefire thinks your JUnit dependency is version 3.
> We've got JUnit 4.4 configured here and it runs both 3- and 4-style
> tests properly.
> 
> Is it possible to post the output of mvn help:effective-pom here?
> 
> - John
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943444.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by John Stoneham <ly...@lyrically.net>.
>> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
>>> I have JUnit 4.5 as a dependency in my maven pom
>>> and I have imported annotations into my test case but
>>> it is not recognizing the @Test and @Ignore annotations.
>>>
>>> I still have to preface the method name with "test"
>>> and the @Ignore tests get executed.
>>>
>>> Is something broken?  What do I need to do to get this
>>> to work like expected and to take advantage of JUnit 4.x
>>> which has over a year of release now.

Hm. Last time this happened to me it was because I was trying to
repackage JUnit with a bunch of other things, and it turned out
surefire was inspecting my POM to look for a junit:junit dependency,
then pulling the version off that to determine whether to look for
JUnit 4 tests.

Sounds to me like surefire thinks your JUnit dependency is version 3.
We've got JUnit 4.4 configured here and it runs both 3- and 4-style
tests properly.

Is it possible to post the output of mvn help:effective-pom here?

- John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Jörg Schaible <jo...@gmx.de>.
CheapLisa wrote:

> 
> I'm not sure I understand.  I don't have the surefire plugin in any of my
> pom's.

Well, if you're not pleased with its default configuration, then it's time
to configure it yourself.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I'm not sure I understand.  I don't have the surefire plugin in any of my
pom's.  It's in the superpom so I can use it from there.

I have a multi-module project.

L



Jörg Schaible-2 wrote:
> 
> CheapLisa wrote at Mittwoch, 10. Dezember 2008 17:16:
> 
>> 
>> I should not have to name it anything but put an annotation there like
>> @Test. This is OK with JUnit 4.x.
> 
> Surefire cannot know which JUnit version you're going to use. So simply
> configure the includes of the surefire plugin to use any java file.
> 
> - Jörg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20943440.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Jörg Schaible <jo...@gmx.de>.
CheapLisa wrote at Mittwoch, 10. Dezember 2008 17:16:

> 
> I should not have to name it anything but put an annotation there like
> @Test. This is OK with JUnit 4.x.

Surefire cannot know which JUnit version you're going to use. So simply
configure the includes of the surefire plugin to use any java file.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by CheapLisa <li...@purpleblade.net>.
I should not have to name it anything but put an annotation there like @Test. 
This is OK with JUnit 4.x.



Josh Suereth wrote:
> 
> I believe the name of  the class still matters.  Try calling it
> "Test*.java"
> 
> On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:
> 
>>
>> I have JUnit 4.5 as a dependency in my maven pom
>> and I have imported annotations into my test case but
>> it is not recognizing the @Test and @Ignore annotations.
>>
>> I still have to preface the method name with "test"
>> and the @Ignore tests get executed.
>>
>> Is something broken?  What do I need to do to get this
>> to work like expected and to take advantage of JUnit 4.x
>> which has over a year of release now.
>>
>>
>> thanks
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20937849.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is Maven / JUnit 4.x broken (annotations)

Posted by Josh Suereth <jo...@gmail.com>.
I believe the name of  the class still matters.  Try calling it "Test*.java"

On Wed, Dec 10, 2008 at 12:16 AM, CheapLisa <li...@purpleblade.net> wrote:

>
> I have JUnit 4.5 as a dependency in my maven pom
> and I have imported annotations into my test case but
> it is not recognizing the @Test and @Ignore annotations.
>
> I still have to preface the method name with "test"
> and the @Ignore tests get executed.
>
> Is something broken?  What do I need to do to get this
> to work like expected and to take advantage of JUnit 4.x
> which has over a year of release now.
>
>
> thanks
>
> Lisa
> --
> View this message in context:
> http://www.nabble.com/Is-Maven---JUnit-4.x-broken-%28annotations%29-tp20929389p20929389.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>