Search code examples
mavenmaven-surefire-plugin

How to change default maven surefire plugin to higher version?


Now I'm running Maven 3.0.3 and it uses maven-surefire-plugin:2.7.2, but I want Maven to use a higher version of maven-surefire-plugin


Solution

  • The better way to declare versions of plugins is to use pluginManagement:

    <build>
      <pluginManagement>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>2.22.0</version>
         </plugin>
         ...
       </plugins>
     </pluginManagement>
    </build>
    

    Furthermore, it's best practice to declare all plugins and their appropriate version via pluginManagement in a parent pom (usually a company pom).