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

   ## Summary
   
   When `mvnup` (Maven 4's built-in upgrade tool) adds the 
`maven-toolchains-plugin` with `select-jdk-toolchain` goal for projects that 
need an older JDK, it generates an invalid version range `(,-1]` as the JDK 
version constraint. Maven then fails to find a matching toolchain.
   
   ## Reproduction
   
   Affected project (found in maven4-testing rc-6 run):
   - [netbeans-html4j](https://github.com/gnodet/maven4-testing/issues/39661)
   
   ## Error
   
   ```
   [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-toolchains-plugin:3.2.0:select-jdk-toolchain
           (default) on project pom: Cannot find matching toolchain definitions 
for the following
           toolchain types:{version=(,-1]}
   [ERROR] Define the required toolchains in your ~/.m2/toolchains.xml file.
   ```
   
   ## Root cause
   
   `mvnup`'s toolchain injection logic computes a version upper bound from the 
project's `maven.compiler.source` (or similar). When the source level is 
detected as an invalid or ambiguous value, the upper bound calculation produces 
`-1`, resulting in the nonsensical range `(,-1]`.
   
   This is a bug in the version range computation in mvnup's 
`AddToolchainsStrategy` (or equivalent).
   
   ## Expected behavior
   
   The generated version range should be valid (e.g. `[8,9)` for a project that 
needs JDK 8, or `[17,18)` for JDK 17). If the source level cannot be 
determined, mvnup should either skip toolchain injection or use a safe default.
   
   ## Maven version
   
   Maven 4.0.0-rc-6 / maven-4.0.x branch (mvnup built-in)
   


-- 
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