Unable to force newer version of surefire-plugin in Maven

1.4k views Asked by At

I have a maven project and I am using the surefire-plugin to run my tests. Previously, I didn't force any version and maven picked up the 2.4.3 for me (why ??).

I want to use 2.7.2 instead, which has better support for JUnit4 (especially Parametrized tests).

Hence, I have modified the root parent POM like this :

    <pluginManagement>
             <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.surefire</groupId>
                    <artifactId>surefire-junit47</artifactId>
                    <version>2.7.2</version>
                </dependency>
            </dependencies>
                            <configuration>
                                 <skipTests>true</skipTests>
                            </configuration> 
        </plugin>
          </plugins>
    </pluginManagement>

However, in the child modules, this is surefire:2.4.3 that keeps being called. Here is the -X debug trace :

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test'

Whereas in the parent pom, 2.7.2 is used:

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test'

And even the effective-pom shows that the "version" of the plugin if not inherited in child modules:

 <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.4.3</version>
    <configuration>
      <skipTests>true</skipTests>
    </configuration>
  </plugin>

Any help would be much appreciated.

Regards, Raphael

0

There are 0 answers