23 January 2007

Maven 2 Surefire plugin works with Junit 4

The latest snapshot of the Surefire plugin for Maven2 now works with JUnit4. Read about it on the JIRA issue.

To use it right now you'll need to add a pluginRepository and declare a specific version of the plugin.

Here is a complete pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test-junit4</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>maven-snapshot-repository</id>
<url>http://people.apache.org/maven-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

No comments: