Skip to content

feat: Upgrade to Java 21#2

Open
simbo1905 wants to merge 2 commits intomasterfrom
feat/java-21-upgrade
Open

feat: Upgrade to Java 21#2
simbo1905 wants to merge 2 commits intomasterfrom
feat/java-21-upgrade

Conversation

@simbo1905
Copy link
Copy Markdown
Owner

Summary

Upgrades the project to Java 21 LTS to align with modern standards.

Changes

  • Updated pom.xml to set source and target compatibility to Java 21.
  • Updated Dockerfile to use:
    • Base builder image: maven:3.9-eclipse-temurin-21
    • Runtime/Test image: ghcr.io/graalvm/nodejs-community:21
  • Added GitHub Actions workflow (.github/workflows/maven.yml) to:
    • Build with Java 21 using Maven.
    • Build the Docker image to verify integration and polyglot tests.
    • Support manual triggers via workflow_dispatch.

Verification

  • CI workflow added and triggered by this PR.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @simbo1905, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on modernizing the project's technology stack by upgrading its core Java version to Java 21 Long-Term Support. This change involves updating key configuration files like pom.xml to reflect the new compiler targets and adjusting Docker images to ensure the build and runtime environments are fully compatible. Additionally, a new CI workflow has been introduced to automatically validate these updates, ensuring a smooth transition and continued stability for the project.

Highlights

  • Java Version Upgrade: The project has been upgraded to Java 21 LTS, aligning with modern standards and leveraging the latest language features and performance improvements.
  • Dockerfile Updates: The Dockerfile now uses maven:3.9-eclipse-temurin-21 for the build stage and ghcr.io/graalvm/nodejs-community:21 for the runtime/test stage, ensuring Docker environments are compatible with Java 21.
  • Maven Configuration: The pom.xml file has been updated to set the maven.compiler.source and maven.compiler.target properties to 21, reflecting the new Java version.
  • New GitHub Actions Workflow: A new GitHub Actions workflow (.github/workflows/maven.yml) has been added to automate building the project with Java 21 using Maven and to build the Docker image, verifying integration and polyglot tests. It also supports manual triggers.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/maven.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request upgrades the project to Java 21 by updating the Java version in pom.xml and the base images in the Dockerfile. The changes are straightforward and achieve the goal. I've provided a couple of suggestions to improve the configuration. In pom.xml, I recommend using the maven.compiler.release property for a more robust compiler configuration. In the Dockerfile, I suggest using a more specific image tag for the GraalVM image to ensure reproducible builds.

Dockerfile Outdated

# Copy the result to graaljs and test node.js+java in the same vm
FROM ghcr.io/graalvm/nodejs-community:23.0.2-jvm17-ol9-20231024 AS graal
FROM ghcr.io/graalvm/nodejs-community:21 AS graal
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a floating tag like 21 can lead to non-reproducible builds as it can be updated with breaking changes. It's recommended to pin the image to a more specific, immutable tag. For example, a tag that includes the full version and build date, similar to the previously used tag 23.0.2-jvm17-ol9-20231024. Please check the available tags for ghcr.io/graalvm/nodejs-community and use a more specific one for Java 21 to ensure build stability.

Comment on lines +41 to +42
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

A more modern approach since Java 9 is to use the maven.compiler.release property. It sets both source and target compatibility and also ensures the code doesn't use APIs from a newer JDK. This simplifies the configuration and makes it more robust.

Suggested change
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>21</maven.compiler.release>

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.

1 participant