gnodet opened a new issue, #12087:
URL: https://github.com/apache/maven/issues/12087

   ## Description
   
   The `PluginUpgradeStrategy` in mvnup does not include 
`maven-surefire-plugin` or `maven-failsafe-plugin` in its list of plugins to 
upgrade for Maven 4 compatibility. Old versions of surefire (e.g., 3.1.2) are 
incompatible with Maven 4 and fail with:
   
   ```
   IllegalStateException: No instance of Project is bound to the mojo execution 
scope.
     at MojoExecutionScopeModule.configure(MojoExecutionScopeModule.java:51)
     while locating Project ("org.apache.maven.api.Project")
   ```
   
   ## Problem
   
   When a project declares `maven-surefire-plugin:3.1.2` (or similar older 
versions), `mvnup apply` runs the `PluginUpgradeStrategy` but reports "No 
plugin upgrades needed" because surefire/failsafe are not in the upgrade list.
   
   The current upgrade list includes: `maven-compiler-plugin`, 
`maven-exec-plugin`, `maven-enforcer-plugin`, `maven-shade-plugin`, 
`maven-remote-resources-plugin` — but not surefire or failsafe.
   
   ## Example
   
   `apache/iotdb-extras` declares surefire:3.1.2 in its POM (lines 1504-1509):
   ```xml
   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
       <version>3.1.2</version>
       ...
   </plugin>
   ```
   
   After `mvnup apply`, the version remains 3.1.2 and the build fails with 
Maven 4.
   
   ## Proposed Fix
   
   Add `maven-surefire-plugin` and `maven-failsafe-plugin` to the 
`PluginUpgradeStrategy` with a minimum compatible version for Maven 4 (e.g., 
3.5.2):
   
   ```java
   new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, 
"maven-surefire-plugin", "3.5.2", MAVEN_4_COMPATIBILITY_REASON),
   new PluginUpgradeInfo(DEFAULT_MAVEN_PLUGIN_GROUP_ID, 
"maven-failsafe-plugin", "3.5.2", MAVEN_4_COMPATIBILITY_REASON),
   ```
   
   ## Impact
   
   Found during Maven 4 compatibility testing of ~960 Apache projects. Projects 
with older surefire versions fail with Maven 4 even after mvnup applies all its 
upgrades.
   
   _Claude Code on behalf of Guillaume Nodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to