Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to target specifier supported by release flag in newer JDKs #326

Closed
wants to merge 1 commit into from

Conversation

pzygielo
Copy link

@pzygielo pzygielo commented Dec 3, 2022

This would allow to use mojo.java.target directly to configure maven.compiler.release.

@slawekjaranowski
Copy link
Member

ups:

Error:  Rule 4: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.8.0-352 is not in the allowed range 8.

Looks like issue/bug in enforcer-maven-plugin

@pzygielo pzygielo marked this pull request as draft December 3, 2022 10:32
@pzygielo
Copy link
Author

pzygielo commented Dec 3, 2022

I'm going push change to minimalJavaBuildVersion and add some comment here after that.

@pzygielo
Copy link
Author

pzygielo commented Dec 3, 2022

I guess there is only documentation purpose of requireJavaVersion used here.

With JDK 1.7 I'm getting:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.1.0:enforce (mojo-enforcer-rules) on project mojo-parent: Execution mojo-enforcer-rules of goal org.apache.maven.plugins:maven-enforcer-plugin:3.1.0:enforce failed: Unable to load the mojo 'enforce' in the plugin 'org.apache.maven.plugins:maven-enforcer-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/enforcer/EnforceMojo : Unsupported major.minor version 52.0
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-enforcer-plugin:3.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

anyway.

@pzygielo pzygielo marked this pull request as ready for review December 3, 2022 11:01
@slawekjaranowski
Copy link
Member

I guess there is only documentation purpose of requireJavaVersion used here.

With JDK 1.7 I'm getting:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.1.0:enforce (mojo-enforcer-rules) on project mojo-parent: Execution mojo-enforcer-rules of goal org.apache.maven.plugins:maven-enforcer-plugin:3.1.0:enforce failed: Unable to load the mojo 'enforce' in the plugin 'org.apache.maven.plugins:maven-enforcer-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/enforcer/EnforceMojo : Unsupported major.minor version 52.0
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-enforcer-plugin:3.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

anyway.

No way for 1.7

Comment on lines +193 to +194
<!-- as expected by Enforcer -->
<minimalJavaBuildVersion>1.8</minimalJavaBuildVersion>
Copy link
Member

Choose a reason for hiding this comment

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

It a little will complicate when project set target as 8 also want to check if used JDK is ok.
In such case we will must remember to set another property also.

My proposition is to postpone this, and allow 8 as 1.8 for maven enforcer.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

enforcer released and upgraded here, we can continue with it

@pzygielo
Copy link
Author

pzygielo commented Dec 3, 2022

No way for 1.7

I don't understand.
I think I've said the same.

My question is - what's the point of requiring Java Version with enforcer to be at least 1.8 when that condition can't be validated with earlier JDK?

That's what bothers me: JDK at least 8 is (currently) enforced by the m-enforcer-p anyway in not very friendly manner, without the rule itself.

@slawekjaranowski
Copy link
Member

My question is - what's the point of requiring Java Version with enforcer to be at least 1.8 when that condition can't be validated with earlier JDK?

That's what bothers me: JDK at least 8 is (currently) enforced by the m-enforcer-p anyway in not very friendly manner, without the rule itself.

Similar:
https://issues.apache.org/jira/browse/MNG-7566

Currently plugin minimum JDK is not verified ... it cause a error in runtime.

Most of maven core plugins requires 1.8 today, Maven from 3.9 also will required 1.8

By the way, interesting discussion how to inform users of minimum JDK, when user try to execute Maven build with not supported JDK.

@pzygielo pzygielo marked this pull request as draft December 21, 2022 09:32
@slawekjaranowski
Copy link
Member

Suppressed by #359
@pzygielo thanks for idea

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.

2 participants