Maven Surefire 2.3 released with support for JUnit 4

Surefire 2.3 for Maven has been released March 1st.
No big announcements, just a post on the maven mailing list. Still, it is a big deal for me, as I can at last run my JUnit 4 tests with Maven.

Note that your build will not pick up the version by default (at least, it didn’t for me); maybe that’s because I had an older version on my system already? You’ll need to change your pom.xml.

In my case, because I already had JUnit 4 tests and Surefire 2.2 was failing, I had the following lines in my pom.xml:

<plugin>
  <artifactid>maven-surefire-plugin</artifactid>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

To use Surefire 2.3, I had to change it to:

<plugin>
  <artifactid>maven-surefire-plugin</artifactid>
  <version>2.3</version>
</plugin>

About Eric Lefevre-Ardant

Independent technical consultant.
This entry was posted in java, maven, test. Bookmark the permalink.

3 Responses to Maven Surefire 2.3 released with support for JUnit 4

  1. Paul Keogh says:

    Thanks for this ! – saved me some time this morning.

  2. sammi says:

    I met a similar problem here. If my test class name is

    ****Tests.java it doesn’t work in Maven+Junit4 but works in eclipse+Junit4;

    I tested in maven2+junit4, I must use such convention:

    ****Test.java, No s added. So I must rename all my test classes to such name convention.

    It took me many hours to get the point. I thought I’m so stupid.

Comments are closed.