开发者

Unable to force newer version of surefire-plugin in Maven

开发者 https://www.devze.com 2023-02-11 03:11 出处:网络
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 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&g开发者_JAVA百科t;

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

精彩评论

暂无评论...
验证码 换一张
取 消