[ 
https://issues.apache.org/jira/browse/HADOOP-19779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050728#comment-18050728
 ] 

ASF GitHub Bot commented on HADOOP-19779:
-----------------------------------------

cnauroth opened a new pull request, #8173:
URL: https://github.com/apache/hadoop/pull/8173

   ### Description of PR
   
   1. Pull up the properties controlling Java version from 
hadoop-project/pom.xml to the root pom.xml. This is so that the same properties 
for Java version can be controlled across the whole project, even at points 
where we aren't getting inheritance from hadoop-project/pom.xml.
   1. Update the Java compiler target version and enforced range to be 17+.
   
   ### How was this patch tested?
   
   ```
   mvn clean package -DskipTests -DskipShade
   ```
   
   On Java 17, it succeeds. On Java 8, it fails fast with this error message:
   
   ```
   [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (clean) on project 
hadoop-main: 
   [ERROR] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion 
failed with message:
   [ERROR] Detected JDK version 1.8.0-472 
(JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.472.b08-1.el8.x86_64/jre) is 
not in the allowed range [17,).
   ```
   
   ### For code changes:
   
   - [X] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   ### AI Tooling
   
   If an AI tool was used:
   
   - [ ] The PR includes the phrase "Contains content generated by <tool>"
         where <tool> is the name of the AI tool used.
   - [ ] My use of AI contributions follows the ASF legal policy
         https://www.apache.org/legal/generative-tooling.html




> Use enforcer to fail fast if building with Java <17
> ---------------------------------------------------
>
>                 Key: HADOOP-19779
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19779
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: build
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>            Priority: Major
>
> Now that trunk has gone to Java 17, we've had some reports of confusion when 
> accidentally building with a down-level Java. It goes into the 
> hadoop-annotations build and reports the --add-modules compiler option isn't 
> recognized, but it doesn't do anything to indicate that root cause is the 
> Java version. We can improve on this by updating our enforcer plugin rules to 
> check for Java 17+ and fail with an error message clearly pointing out the 
> Java version.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to