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

feat: add appengine maven sample for jdk 21 #9432

Merged
merged 13 commits into from
Oct 4, 2024
Merged

feat: add appengine maven sample for jdk 21 #9432

merged 13 commits into from
Oct 4, 2024

Conversation

mpeddada1
Copy link
Contributor

@mpeddada1 mpeddada1 commented Aug 2, 2024

Description

For b344685188

The sample in https://github.com/GoogleCloudPlatform/java-docs-samples/tree/main/appengine-java8/helloworld still contains instructions for Java 8. Running the sample as-is results in alongside instructions in https://cloud.google.com/appengine/docs/standard/java-gen2/using-maven alongside the helloworld sample in java-docs-samples:

[INFO] GCLOUD:     [ORIGINAL ERROR] generic::invalid_argument: Error(s) encountered validating runtime. Runtime java8 is end of support and no longer allowed. Please use the latest Java runtime for App Engine Standard. For internal google applications, please see go/gae-end-of-support.
[INFO] GCLOUD:     com.google.net.rpc3.RpcException: generic::INVALID_ARGUMENT: Error(s) encountered validating runtime. Runtime java8 is end of support and no longer allowed. Please use the latest Java runtime for App Engine Standard. For internal google applications, please see go/gae-end-of-support. [google.rpc.error_details_ext] { code: 3 message: "Error(s) encountered validating runtime. Runtime java8 is end of support and no longer allowed. Please use the latest Java runtime for App Engine Standard. For internal google applications, please see go/gae-end-of-support." }

The official documentation page describes Java 8 as being out of support as of Jan, 2024.

This PR introduces sample that is compatible with the latest LTS (JDK 21).

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: appengine Issues related to the App Engine Admin API API. labels Aug 2, 2024
@mpeddada1
Copy link
Contributor Author

TODO: Once a new version of shared-configurations has been published, update the POM.

@minherz minherz removed their assignment Aug 14, 2024
@minherz
Copy link
Contributor

minherz commented Aug 14, 2024

Please assign after PR is ready for review.

@telpirion telpirion self-assigned this Aug 22, 2024
@mpeddada1
Copy link
Contributor Author

Next error:

[ERROR]   The project com.example.appengine:helloworld-jdk21:1.0-SNAPSHOT (/tmpfs/src/github/java-docs-samples/appengine-java21/helloworld/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.example.appengine:helloworld-jdk21:1.0-SNAPSHOT: Could not find artifact com.google.cloud.samples:shared-configuration:pom:1.2.1 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 26, column 11 -> [Help 2]

It looks like v1.2.1 is not available on maven central: https://repo1.maven.org/maven2/com/google/cloud/samples/shared-configuration/

@telpirion
Copy link
Contributor

I agree, the most current version available is 1.2.0. Can you rebuild this PR using v1.2.0?

@mpeddada1
Copy link
Contributor Author

mpeddada1 commented Aug 27, 2024

I agree, the most current version available is 1.2.0. Can you rebuild this PR using v1.2.0?

Thanks for the question, @telpirion. v1.2.0 brings in an older version of the jacoco plugin (v0.8.7) which isn't compatible with java 21 and results in the following issue:

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.7:report (report) on project helloworld-jdk21: An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing /usr/local/google/home/mpeddada/java-docs-samples/appengine-java21/helloworld/target/helloworld-jdk21-1.0-SNAPSHOT/WEB-INF/classes/com/example/appengine/java21/HelloAppEngine.class. Unsupported class file major version 65

We are looking for v1.2.1 because it contains an update of jacoco 0.8.12 which supports java 21 (https://github.com/GoogleCloudPlatform/java-repo-tools/releases/tag/v1.2.1). However, it looks like the github release was published but the actual release job of the artifact to maven central didn't get kicked off.

@mpeddada1 mpeddada1 marked this pull request as ready for review September 25, 2024 18:07
@telpirion telpirion merged commit a65d5ac into main Oct 4, 2024
11 checks passed
@telpirion telpirion deleted the test-jdk21 branch October 4, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: appengine Issues related to the App Engine Admin API API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants