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

Upgrade to JDK17. #2342

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

VenkatasivareddyTR
Copy link
Contributor

@VenkatasivareddyTR VenkatasivareddyTR commented Oct 18, 2024

Issue #, if available:
#2295
Description of changes:
Upgrade to JDK 17.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch 3 times, most recently from 41ac014 to 829112e Compare October 22, 2024 12:55
@VenkatasivareddyTR VenkatasivareddyTR marked this pull request as ready for review October 22, 2024 13:27
@VenkatasivareddyTR VenkatasivareddyTR changed the title Upgrade to JDK17 initial commit. Upgrade to JDK17. Oct 23, 2024
@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch from 829112e to b349377 Compare October 23, 2024 07:36
@macohen macohen requested a review from mschoeni1 October 23, 2024 20:59
@macohen
Copy link
Contributor

macohen commented Oct 23, 2024

Thanks @VenkatasivareddyTR; can you check on the build error, please:

Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project aws-athena-federation-sdk: Fatal error compiling: error: release version 17 not supported -> [Help 1]

https://github.com/awslabs/aws-athena-query-federation/actions/runs/11475342726/job/31973995753?pr=2342

@VenkatasivareddyTR
Copy link
Contributor Author

@macohen The build process appears to be running on JDK 11. To align with the codebase, we need to update the build environment to use JDK 17.

@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch 3 times, most recently from fb69b22 to f99d706 Compare October 25, 2024 11:35
@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch 2 times, most recently from 1e45563 to 33975a3 Compare October 30, 2024 08:01
@macohen
Copy link
Contributor

macohen commented Oct 31, 2024

the code looks fine, but the GH actions are breaking and won't work until we're building with JDK 17 it seems. Is that right? are you able to update the actions (I know this build still won't pass until those are merged)...

@abhishekpoddar-trianz
Copy link

Yes correct, we would need to update the GH actions with JDK 17 to build this PR successfully. We have tested this in our local environments with JDK 17 setup.

To update the GH actions to take JDK 17, we are updating the respective YAML files (in .github/workflows/). We will be testing it in a fork before raising the PR for the same.

@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch 2 times, most recently from 095feec to 975ff59 Compare November 4, 2024 12:21
@abhishekpoddar-trianz
Copy link

PR for GitHub Actions update for java 17.
#2377

@macohen
Copy link
Contributor

macohen commented Dec 10, 2024

@mschoeni1 can we merge this into a new branch and then merge master on top of that? I think we need to work on producing JDK 11 AND JDK 17 builds in GH actions before that gets merged back to master. What do you think? cc: @aimethed

@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch 2 times, most recently from 92758b0 to d150592 Compare January 9, 2025 10:44
@Jithendar12 Jithendar12 force-pushed the feature/upgrade_jdk17 branch from d150592 to c4d7c73 Compare January 9, 2025 10:48
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.17%. Comparing base (7b40bf4) to head (242e4ba).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2342      +/-   ##
============================================
+ Coverage     61.09%   61.17%   +0.07%     
- Complexity     3738     3751      +13     
============================================
  Files           576      577       +1     
  Lines         21348    21435      +87     
  Branches       2654     2661       +7     
============================================
+ Hits          13043    13112      +69     
- Misses         7037     7052      +15     
- Partials       1268     1271       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mschoeni1
Copy link
Contributor

Thanks @Jithendar12, this looks great. Could you please just also update the README to include the command for users to be able to build with JDK17?

@Jithendar12
Copy link
Contributor

Thanks @Jithendar12, this looks great. Could you please just also update the README to include the command for users to be able to build with JDK17?

Hi @mschoeni1 ,

Thank you for reviewing the PR! I believe it would be better to create a separate wiki page for this and provide a reference to it in the main README.

Please find below sample wiki page that i have created in my fork and documentation for the content. Let us know your thoughts on this.Thank you!

https://github.com/Jithendar12/aws-athena-query-federation/wiki/How-To-Build-And-Deploy-A-Connector-Using-JDK-17

jdk17-connector-build.odt

@AbdulR3hman
Copy link
Contributor

few questions;

  1. regarding JAVA_TOOL_OPTIONS being used as ARG vs ENV; then we proceed by setting the empty ARG to the ENV; but the comment says we are setting it to JDK 17; I think I might be missing something. I assume from this comment [RFC] JDK 17 Upgrade & JDK LTS  #2295 (comment) it is coming from yaml; where exactly?

  2. we're adding JDK 17 profiles to athena-federation-sdk/pom.xml | but at the same time we are adding both JDK8 and 17 to the main pom.xml; why the discrepancy?

  3. Following up from that; if we added the profile in the main maven; profiles are not inherited according to maven docs; this is why I assume we are using activation in order to enable the profile on children POMs?

  4. Same goes for the plugins; the parent pom file has maven-surefire-plugin introduced to it; why are we introducing the same code to all children? But the plugins are inherited by children POM; so why are we doing this?

  5. Lastly; where are you plan to utilize the jdk 17 profile? that was introduced?

@Jithendar12
Copy link
Contributor

few questions;

1. regarding `JAVA_TOOL_OPTIONS` being used as `ARG` vs `ENV`;  then we proceed by setting the empty ARG to the ENV; but the comment says we are setting it to JDK 17; I think I might be missing something. I assume from this comment [[RFC] JDK 17 Upgrade & JDK LTS  #2295 (comment)](https://github.com/awslabs/aws-athena-query-federation/issues/2295#issuecomment-2422484927) it is coming from yaml; where exactly?

2. we're adding JDK 17 profiles to `athena-federation-sdk/pom.xml` | but at the same time we are adding both JDK8 and 17 to the main `pom.xml`; why the discrepancy?

3. Following up from that; if we added the profile in the main maven; profiles are not inherited according to [maven docs](https://maven.apache.org/guides/introduction/introduction-to-profiles.html#Profile_Inheritance); this is why I assume we are using [activation](https://maven.apache.org/guides/introduction/introduction-to-profiles.html#JDK) in order to enable the profile on children POMs?

4. Same goes for the plugins; the parent pom file has `maven-surefire-plugin` introduced to it; why are we introducing the same code to all children? But the plugins are inherited by children POM; so why are we doing this?

5. Lastly; where are you plan to utilize the jdk 17 profile? that was introduced?

Hi @AbdulR3hman ,

  1. We pass JAVA_TOOL_OPTIONS as a build argument (--build-arg) when building the Docker image. During the build process, the ARG is used to set the ENV variable in the image.
    Example command:
    docker build --build-arg JAVA_VERSION=17 --build-arg JAVA_TOOL_OPTIONS="--add-opens=java.base/java.nio=ALL-UNNAMED" -t athena-federation-repository-snowflake:2022.47.1 .

  2. The JDK 8 profile in the main pom.xml ensures that if a user is building the code with JDK 8 locally, then maven.compiler.release is overridden to 8. This avoids compatibility issues and ensures the correct compiler version is used.

  3. Yes, you are correct. The activation ensures that the profiles are automatically enabled based on the detected JDK version. When the JDK version matches the activation criteria (e.g., jdk=17), the properties and plugins defined in the profile are applied automatically, even in child POMs.

  4. Not all child pom, only few where we have explicility added this plugin instead of picking up from the main pom. This forced me to add profile again in those pom's.

  5. The JDK 17 profile is used for setting maven.compiler.release to 17 and
    adding --add-opens=java.base/java.nio=ALL-UNNAMED option to the Surefire and Failsafe plugins. This configuration is required to ensure the unit and integration tests run successfully on JDK 17, as documented here.

Please refer to my wiki page on how we are building and deploying the connector using JDK 17. Thank you!

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.

6 participants