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 — [3.9.x] MavenPluginJavaPrerequisiteChecker: Handle 8/1.8 Java version in ranges as well by cstamas · Pull Request #11577 · apache/maven

Conversation

@cstamas

@cstamas cstamas commented Dec 18, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Java is consistent when reporting versions, but users are not. No need to go below 1.8, as Maven 3.9 is Java 8 only. This PR makes "8/1.8" work for ranges as well, not only for standalone version.

Fixes #11575

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cstamas
Make up for users inconsistency
fb7da96
Java is consistent when reporting versions, but users are not.

Fixes apache#11575
@cstamas cstamas added this to the 3.9.13 milestone Dec 18, 2025
@cstamas
cstamas requested review from gnodet, hboutemy and slawekjaranowski December 18, 2025 13:00
@cstamas cstamas self-assigned this Dec 18, 2025
@cstamas cstamas added bug Something isn't working mvn3 labels Dec 18, 2025
@cstamas
cstamas marked this pull request as ready for review December 18, 2025 13:17
cstamas added 2 commits December 18, 2025 14:22
@cstamas
More tests
d0b3a12
@cstamas
More UTs
c3ae642
Bukama
Bukama reviewed Dec 18, 2025
View reviewed changes
Comment thread ...-core/src/main/java/org/apache/maven/plugin/internal/MavenPluginJavaPrerequisiteChecker.java
}
VersionConstraint constraint;
try {
constraint = versionScheme.parseVersionConstraint(requiredVersion.equals("8") ? "1.8" : requiredVersion);

@Bukama Bukama Dec 18, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

two lines above you substring currentVersion here it's about requiredVersion. Is it intended or are you accidently mixing variables?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
slawekjaranowski
slawekjaranowski approved these changes Dec 18, 2025
View reviewed changes
Bukama
Bukama reviewed Dec 18, 2025
View reviewed changes
Comment thread ...e/src/test/java/org/apache/maven/plugin/internal/MavenPluginJavaPrerequisiteCheckerTest.java
@@ -30,7 +30,22 @@ public class MavenPluginJavaPrerequisiteCheckerTest {
public void testMatchesVersion() {

@Bukama Bukama Dec 18, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Use Parameterized tests here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cstamas cstamas Dec 18, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Did the change as you asked, but now fails with checkstyle:

Error:  src/test/java/org/apache/maven/plugin/internal/MavenPluginJavaPrerequisiteCheckerTest.java:[67,19] (design) VisibilityModifier: Variable 'requiredVersion' must be private and have accessor methods.
Error:  src/test/java/org/apache/maven/plugin/internal/MavenPluginJavaPrerequisiteCheckerTest.java:[70,19] (design) VisibilityModifier: Variable 'currentVersion' must be private and have accessor methods.
Error:  src/test/java/org/apache/maven/plugin/internal/MavenPluginJavaPrerequisiteCheckerTest.java:[73,20] (design) VisibilityModifier: Variable 'expected' must be private and have accessor methods.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cstamas cstamas Dec 18, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Clearly the two are not aligned: as if I make field private or just non-public, I get

Cannot set parameter 'requiredVersion'. Ensure that the field 'requiredVersion' is public.

So one want this, other want that.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slawekjaranowski reacted with laugh emoji
All reactions
  • 😄 1 reaction

@slawekjaranowski slawekjaranowski Dec 18, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

do it simple, you can try to add suppress for checkstyle, by the way I'm working on move test to JUnit 5 in #11547

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cstamas added 2 commits December 18, 2025 17:30
@cstamas
Parameterized test
8c00268
@cstamas
Revert "Parameterized test"
f8b23af
This reverts commit 8c00268.
slawekjaranowski
slawekjaranowski approved these changes Dec 18, 2025
View reviewed changes

@slawekjaranowski slawekjaranowski left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I would like to change a PR title to be more descriptive what is fixed 😄

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slawekjaranowski slawekjaranowski linked an issue Dec 18, 2025 that may be closed by this pull request
Java prerequisites for Maven Plugins fails for Java 8 #11575
Closed
@kwin

kwin commented Dec 19, 2025

Copy link
Copy Markdown
Member

What about Maven 4? Shouldn't the versions be interpreted the same?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cstamas

cstamas commented Dec 19, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

What about Maven 4? Shouldn't the versions be interpreted the same?

Maven4 is Java 17+, hence it does not need to handle 8/1.8 (both are less than 17).

Maven 3 can run on Java 8 and higher, and the problem is really ONLY when it runs on Java 8 (as it reports 1.8 as version), but users are inconsistent, and may use "8" or "1.8", depending on their mood.

slawekjaranowski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cstamas cstamas changed the title [3.9.x] Make up for users inconsistency [3.9.x] MavenPluginJavaPrerequisiteChecker: Handle 8/1.8 Java version in ranges as well Dec 19, 2025
@cstamas
cstamas merged commit c2e4be2 into apache:maven-3.9.x Dec 19, 2025
@cstamas
cstamas deleted the maven-3.9.x-gh-11575 branch December 19, 2025 13:31
@olamy olamy mentioned this pull request Apr 2, 2026
3.10.x Upgrade slf4j to 2.0.17 #11880
Merged
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Bukama Bukama Bukama left review comments
@slawekjaranowski slawekjaranowski slawekjaranowski approved these changes
@gnodet gnodet Awaiting requested review from gnodet
@hboutemy hboutemy Awaiting requested review from hboutemy

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@cstamas cstamas

Labels

bug Something isn't working mvn3

Projects

None yet

Milestone

3.9.13

Development

Successfully merging this pull request may close these issues.

Java prerequisites for Maven Plugins fails for Java 8

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@cstamas @kwin @slawekjaranowski @Bukama
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.