Failed to force new version of correct plugin in Maven

I have a maven project and I use the surefire plugin to run my tests. Previously, I did not force any version, and maven chose 2.4.3 for me (why?).

Instead, I want to use 2.7.2, which better supports JUnit4 (especially parameterized tests).

Therefore, I changed the parent POM of the root as follows:

<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 child modules this is true: 2.4.3, which continues to be called. Here is the -X debug trace:

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

While the parent pump uses 2.7.2:

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

And even 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 greatly appreciated.

Regards, Raphael

+4
source share

Source: https://habr.com/ru/post/1340341/


All Articles