Skip to content

Conversation

@sultan
Copy link

@sultan sultan commented Nov 20, 2025

This PR description was edited to reflect its latest status:

Recurring issues show that Maven’s current handling of qualifiers is incomplete, impacting multiple companies and users:

These issues need to be addressed in Maven Resolver. I am working to encourage Maven to adopt a fix through this PR.

Proposed ordering:

  • alpha < beta < milestone < pr = pre = preview < rc = cr < dev < snapshot < final = ga = release < sp

I edited the documentation to discourage the use of certain qualifiers:

  • The use of pr, pre, preview is discouraged
  • The use of cr is discouraged (use rc instead)
  • The use of dev is discouraged
  • The use of final, ga, release is discouraged (use no qualifier instead)
  • The use of sp is discouraged (increment patch version instead)

Optional inclusions:

  • ea (early access), edr, pfd (drafts), mr

As long as discouraged qualifiers continue to be used in practice, tools will still need to support them. Once they are phased out, however, support can be safely dropped.

Another possible direction would be:

  • Partial SemVer2 support, which could simplify handling of qualifiers:
    • Accept the "+" char as a separator.
    • Temporarily treat discouraged qualifiers as follows (while discouraging their use when necessary):
      • latest pre-release: dev, snapshot
      • release: final, ga, release
      • post-release: sp
    • Treat all other qualifiers as pre-release without hard-coding them, reducing the number of special cases.
    • Use aliases/mapping:
      • a to alpha
      • b to beta
      • m to milestone
      • cr to rc
      • "final", "ga", "release" to ""
  • Maven could force the build to fail if any module uses discouraged qualifiers.
  • Maven Central could begin rejecting new artifacts using discouraged qualifiers.

Thanks for your input.


Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004 you have to acknowledge this by using the following check-box.

@cstamas
Copy link
Member

cstamas commented Nov 27, 2025

@sultan
Copy link
Author

sultan commented Dec 13, 2025

@sultan sultan force-pushed the case_insensitive_lexical_order branch from 311ee68 to 1db950f Compare December 13, 2025 17:34
@sultan
Copy link
Author

sultan commented Dec 13, 2025

we have to discuss how to address the other discouraged qualifiers used in java ee / jarktaee:

in order to fix all the encountered problems. or state on website/javadoc that this will be a no-fix

intend to fix apache/maven#8891 step by step
this PR fixes the following "discouraged qualifiers" :

  • "pr" = "pre" = "preview" < (rc) < "dev" < (snapshot) < "final" = "ga" = "release"

@sultan sultan force-pushed the case_insensitive_lexical_order branch from 1db950f to 8d9bd92 Compare December 13, 2025 18:24
@sultan sultan marked this pull request as ready for review December 13, 2025 18:35
@sultan sultan force-pushed the case_insensitive_lexical_order branch 6 times, most recently from 8f05f18 to d9da093 Compare December 13, 2025 23:00
@sultan sultan force-pushed the case_insensitive_lexical_order branch from d9da093 to 790483d Compare December 14, 2025 01:04
@elharo
Copy link
Contributor

elharo commented Dec 15, 2025

IMPORTANT: https://maven.apache.org/pom.html#Version_Order_Specification is the one and only normative source for maven version comparison.

If there are any bugs in this, file them, one issue per bug.

However, the default assumption is that if the code or other docs differ from what is described here, then it is the code or other doc that is at fault and needs to be changed.

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maven does not, cannot, and will not special case every qualifier any project has ever invented. In particular it does not special case:

  • pr
  • preview
  • pre
  • dev

They are treated like any other string as described in https://maven.apache.org/pom.html#Version_Order_Specification

@sultan
Copy link
Author

sultan commented Dec 15, 2025

Thank you for clarifying the current handling of qualifiers.
This may be acceptable, but IMHO it would be great if Maven could provide more explicit reasoning and guidance:

  • Clarification of rationale: Could you explain why certain qualifiers (e.g. sp from Red Hat) are accepted, while others (like preview from Microsoft or dev from Android) are not? Is this distinction based on legacy behaviour tied to the date of introduction of qualifiers, or on community adoption patterns?
  • Version ordering issues: Will the ordering problems that arise from these differences be considered “no fix”, or is there room for improvement in the resolver logic?
  • Specification transparency: It would help if Maven documented this behaviour in the specification, with the reasoning included, so that users don’t repeatedly open issues about unexpected ordering.
  • Alternative schemes: Would Maven be open to supporting a second version scheme alongside the Generic one, to address these ordering problems more systematically?
  • Ecosystem guidance: Would Maven recommend that tools like Dependabot define their own version scheme to handle these ordering inconsistencies, or should the community expect Maven itself to provide a canonical solution?
  • Statement to vendors: Could Maven also consider making a clear statement to major vendors, encouraging them to avoid problematic qualifiers? For example:
    • Microsoft → stop using preview
    • Red Hat → avoid ga and sp1
    • Android → avoid dev
    • (Positive example: Spring stopped using the release qualifier and aligned with best practices)

Such a statement would help reduce confusion across the ecosystem and promote consistent versioning practices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants