Skip to content

fix: upgrade gradle to 8.11.1 and set java version used to 21.#9623

Merged
plumpy merged 48 commits intoGoogleContainerTools:mainfrom
alphanota:fix-gradle
Jan 7, 2025
Merged

fix: upgrade gradle to 8.11.1 and set java version used to 21.#9623
plumpy merged 48 commits intoGoogleContainerTools:mainfrom
alphanota:fix-gradle

Conversation

@alphanota
Copy link
Copy Markdown
Contributor

@alphanota alphanota commented Dec 19, 2024

Fixes: #nnn
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs

Description

The skaffold integration test TestRun is failing, here is an example error:


* What went wrong:
Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
> Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread "Daemon worker"]

This PR upgrades Gradle to 8.11 and spring-boot to 3.4.1. Due to Gradle's Java requirements, the integration test environment now uses Java 21. The Micronaut tool in the jib-gradle example was also upgraded for compatibility with java 21 and gradle 8.11.

User facing changes (remove if N/A)

The tools used in the jib-gradle and jib-sync examples were upgraded to work with java 21 and gradle 8.11.

Follow-up Work (remove if N/A)

@alphanota alphanota requested a review from a team as a code owner December 19, 2024 19:22
@alphanota alphanota requested a review from mattsanta December 19, 2024 19:22
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Hi team,

I'm currently reviewing this pull request and will have a full review ready in a few minutes. In the meantime, here's a quick summary to help you and other reviewers get up to speed:

This pull request aims to upgrade the Gradle Spring Boot version and enhance support for OpenJDK versions within the Skaffold integration examples. The changes are focused on updating dependencies and build configurations to ensure compatibility and leverage the latest features.

Here's a breakdown of the changes:

  • integration/examples/jib-sync/build.gradle: This file has been modified to upgrade the Spring Boot dependency from version 2.0.5.RELEASE to 2.6.15.
    • Line 3: id 'org.springframework.boot' version '2.0.5.RELEASE' changed to id 'org.springframework.boot' version '2.6.15'
    • Line 25: jib.from.image = 'openjdk:17' changed to jib.from.image = 'openjdk:23'
  • integration/examples/jib-sync/gradle/wrapper/gradle-wrapper.properties: The Gradle wrapper has been updated from version 5.6.4 to 8.10.
    • Line 3: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip changed to distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip

These updates ensure that the example projects remain current and compatible with newer Java versions and Gradle releases. This should improve the overall build process and maintainability of the examples.


And now, a little haiku to lighten the mood:

Code flows like a stream,
Upgrades bring a fresh new spring,
Bugs flee in the breeze.

Best,
Gemini

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

This pull request upgrades Gradle, Spring Boot, and the base OpenJDK version for the jib-sync example. Upgrading dependencies is good practice for maintaining security and leveraging new features. The changes look correct, but there are a few minor suggestions and some points to consider for future updates.

I've referenced the implicit style guide used in the project when making suggestions.

Summary of Changes & Recommendations:

  • Gradle Upgrade: Upgrading from 5.6.4 to 8.10 is a significant jump. Ensure thorough testing to catch any compatibility issues. Consider incrementally upgrading Gradle to intermediate versions first before jumping directly to 8.10. This can help isolate any potential issues.
  • Spring Boot Upgrade: Upgrading from 2.0.5 to 2.6.15 is also substantial. Verify all Spring Boot features used in the project still function as expected. Similar to the Gradle upgrade, consider a staged upgrade approach if feasible.
  • OpenJDK Upgrade: Moving from OpenJDK 17 to 23 is a good move. OpenJDK 23 is not an LTS release. Consider using OpenJDK 21 (LTS) for long-term support and stability.
  • Dependency Management Plugin: Align the Spring Boot and dependency management plugin versions for better compatibility. See the Spring Boot 2.6.15 documentation for the recommended version.
  • JIB Plugin: While updating dependencies, consider upgrading the JIB plugin to the latest version for potential performance improvements and bug fixes.
  • Documentation: Update the project's README or documentation to reflect the new dependency versions.
  • Testing: Add or update integration tests to ensure compatibility with the upgraded dependencies.

@alphanota alphanota requested a review from plumpy December 19, 2024 19:53
Copy link
Copy Markdown
Contributor

@plumpy plumpy left a comment

Choose a reason for hiding this comment

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

Thanks!! I was trying to fix this myself too in #9622 because I thought my PR caused it. But my attempt at fixing it didn't work, so thanks for figuring this out!

Can you copy these changes over to skaffold/examples/jib-sync (which is basically just a copy of this directory)

alphanota and others added 22 commits January 6, 2025 21:35
@alphanota alphanota changed the title fix: upgrade gradle spring boot and support openjdk versions fix: upgrade gradle to 8.11.1 and set java version used to 21. Jan 7, 2025
Copy link
Copy Markdown
Contributor

@plumpy plumpy left a comment

Choose a reason for hiding this comment

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

Hooray, thanks!!

@plumpy plumpy merged commit 00a3b42 into GoogleContainerTools:main Jan 7, 2025
alphanota added a commit to alphanota/skaffold that referenced this pull request Jan 14, 2025
…eContainerTools#9623)

* fix: upgrade gradle spring boot and support openjdk versions

* fix: upgrade gradle spring boot and support openjdk versions

* #fix address PR comments, update all plugins to latest version

* copy changes over to examples/jib-sync

* fix: set source and target compability to 21

* set target jdk to 17

* fix: set java version used in the gradle test to 21. Change the image used in skaffold.yaml so that the ccompiled java application runs in java V21 environment instead of V11.

* run only problematic test and add debug logging

* add debug line

* add vebosity flag

* add debugging code

* add debugging code

* more debug lines

* more debug lines

* more debug lines

* more debug lines

* call gradle directly to get debug error

* Run skaffold dev to see output

* Run TestDevAutoSync.

* remove XDG_CONFIG_HOM environment variable

* remove XDG_CONFIG_HOM environment variable

* run skaffold test

* re-enable all tests and sync the two copies of build.gradle

* update jib-gradle example

* add databind dependency which is needed by netty

* Sync changes in integration/examples/jib-gradle to examples/jib-gradle

* remove jib.fromImage specification in build.gradle since the base image is defined in the skaffold.yaml

* fix jib-gradle/skaffold.yaml, set apiVersion to v4beta11

* use setup-java action to set the java version
@alphanota alphanota deleted the fix-gradle branch January 14, 2025 21:28
@menahyouyeah menahyouyeah mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants