GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Handling of Java versions like 21.0.10.0.1 fails · Issue #966 · apache/maven-enforcer

Handling of Java versions like 21.0.10.0.1 fails #966

New issue
Copy link
New issue
Copy link
Closed
Closed
Handling of Java versions like 21.0.10.0.1 fails#966
Copy link
Labels
bugSomething isn't working

Description

@parttimenerd
parttimenerd
opened on Mar 24, 2026
Issue body actions

Affected version

all

Bug description

The newest SapMachine 21 release has the version string "21.0.10.0.1". When passing this version string directly into the enforcer plugin via:

           <configuration>
              <rules>
                <requireJavaVersion>
                  <version>21.0.10.0.1</version>
                </requireJavaVersion>
              </rules>
            </configuration>

It fails when running on such a Java release (the problem is not SapMachine specific):

[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
[ERROR] Detected JDK /Users/i560383_1/Downloads/sapmachine-jdk-21.0.10.0.1.jdk/Contents/Home is version 21.0.10-0 which is not in the allowed range [21.0.10.0.1,).

This is due to only the normalized (broken here) version string is compared with the actual version.

Code sample in https://github.com/parttimenerd/sapmachine-21.0.10.0.1-demo

Activity

  1. parttimenerd
    added
    bugSomething isn't working
    on Mar 24, 2026
  2. cstamas commented on Mar 24, 2026

    @cstamas
    cstamas
    on Mar 24, 2026
    Member
    More actions

    Error message contains reported version, and it is 21.0.10-0, not 21.0.10.0.1, and Enforcer seems right:

    [cstamas@angeleyes ~]$ jbang --main=org.eclipse.aether.util.version.GenericVersionScheme org.apache.maven.resolver:maven-resolver-util:1.9.27 21.0.10-0 21.0.10.0.1
    Display parameters as parsed by Maven Resolver (in canonical form and as a list of tokens) and comparison result:
    1. 21.0.10-0 -> 21.0.10-0; tokens: [21, 0, 10]
       21.0.10-0 < 21.0.10.0.1
    2. 21.0.10.0.1 -> 21.0.10.0.1; tokens: [21, 0, 10, 0, 1]
    [cstamas@angeleyes ~]$ 
    

    And finally:

    [cstamas@angeleyes ~]$ java -version
    openjdk version "21.0.10" 2026-01-20 LTS
    OpenJDK Runtime Environment SapMachine (build 21.0.10+7-LTS)
    OpenJDK 64-Bit Server VM SapMachine (build 21.0.10+7-LTS, mixed mode, sharing)
    [cstamas@angeleyes ~]$ jshell 
    |  Welcome to JShell -- Version 21.0.10
    |  For an introduction type: /help intro
    
    jshell> System.getProperty("java.version")
    $1 ==> "21.0.10"
    
    jshell> 
    [cstamas@angeleyes ~]$ 
    
  3. parttimenerd commented on Mar 24, 2026

    @parttimenerd
    parttimenerd
    on Mar 24, 2026
    ContributorAuthor
    More actions

    No, you're using a different SapMachine version.

    > java -version           
    openjdk version "21.0.10.0.1" 2026-02-17 LTS
    OpenJDK Runtime Environment SapMachine (build 21.0.10.0.1+1-LTS)
    OpenJDK 64-Bit Server VM SapMachine (build 21.0.10.0.1+1-LTS, mixed mode, sharing)

    The Java version is "21.0.10.0.1" (see https://github.com/SAP/SapMachine/releases/tag/sapmachine-21.0.10.0.1).

  4. parttimenerd commented on Mar 24, 2026

    @parttimenerd
    parttimenerd
    on Mar 24, 2026
    ContributorAuthor
    More actions

    In my opinion:

             <configuration>
                  <rules>
                    <requireJavaVersion>
                      <version>${java.version}</version>
                    </requireJavaVersion>
                  </rules>
                </configuration>

    With ${java.version} being the system property "java.version" of the JVM running the maven version should always succeed.
    We literally require the same Java version as we're currently running with. But it doesn't because of the normalization.

  5. parttimenerd commented on Mar 24, 2026

    @parttimenerd
    parttimenerd
    on Mar 24, 2026
    ContributorAuthor
    More actions

    Thanks for taking a look at this issue. I provided my fix proposal in #967.

  6. Bukama commented on Mar 25, 2026

    @Bukama
    Bukama
    on Mar 25, 2026
    Contributor
    More actions

    Version Range detection is buggy anyway (see my additional tests in #949)

  7. parttimenerd commented on Mar 25, 2026

    @parttimenerd
    parttimenerd
    on Mar 25, 2026
    ContributorAuthor
    More actions

    I saw it. But hopefully my PR could be fixed to at least support this common CI pattern properly

  8. parttimenerd commented on May 14, 2026

    @parttimenerd
    parttimenerd
    on May 14, 2026
    ContributorAuthor
    More actions

    Should be fixed with the merged PR.

  9. parttimenerd
    closed this as completedon May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.