I'm new to Google Cloud and working towards setting up Java IntelliJ with Google Cloud. After running:
gcloud run deploy
IntelliJ throws:
Building using Buildpacks and deploying container to Cloud Run service [helloworld] in project [first-project-himanshu] region [us-central1]
X Building and deploying new service... Building Container.
OK Uploading sources...
- Building Container... Logs are available at [https://console.cloud.google.com/cloud-build/builds/01c579f3-ff0e-438c-8677-c9fe3904f031?project=734796074243].
. Creating Revision...
. Routing traffic...
. Setting IAM Policy...
Deployment failed
ERROR: (gcloud.run.deploy) Build failed; check build logs for details
Logs on Google Cloud show:
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51
[builder] ERROR: failed to build: exit status 1
[builder] Timer: Builder ran for 17.519306196s and ended at 2024-04-04T21:46:25Z
[builder] --------------------------------------------------------------------------------
[builder] -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] If you think you've found an issue, please report it:
[builder] -> https://cloud.google.com/docs/buildpacks/overview
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder] Sorry your project couldn't be built.
[builder] --------------------------------------------------------------------------------
[builder] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[builder] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[builder] [ERROR]
[builder] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[builder] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[builder] [ERROR]
[builder] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project helloworld: Fatal error compiling: error: release version 17 not supported -> [Help 1]
[builder] Warning: JAVA_HOME environment variable is not set.
[builder] failed to build: (error ID: dc066188):
[builder] --------------------------------------------------------------------------------
[builder] Done "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAli..." (11.891255152s)
[builder]
[builder] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[builder]
[builder] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[builder]
[builder] [ERROR]
[builder]
[builder] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[builder]
[builder] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[builder]
[builder] [ERROR]
[builder]
[builder] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project helloworld: Fatal error compiling: error: release version 17 not supported -> [Help 1]
[builder] Warning: JAVA_HOME environment variable is not set.
[builder] Running "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAlive=false -f=pom.xml --quiet"
[builder] --------------------------------------------------------------------------------
[builder] === Java - Maven ([email protected]) ===
[builder] 2024/04/04 21:46:08 [DEBUG] GET https://dl.google.com/runtimes/ubuntu2204/openjdk/openjdk-11.0.22_7.tar.gz
[builder] Installing v11.0.22+7.
[builder] ***** CACHE MISS: "openjdk"
[builder] 2024/04/04 21:46:07 [DEBUG] GET https://dl.google.com/runtimes/ubuntu2204/openjdk/version.json
[builder] Using latest Java 11 runtime version. You can specify a different version with GOOGLE_RUNTIME_VERSION: https://github.com/GoogleCloudPlatform/buildpacks#configuration
[builder] === Java - Runtime ([email protected]) ===
===> BUILDING
[restorer] Timer: Restorer ran for 640.4µs and ended at 2024-04-04T21:46:06Z
[restorer] Timer: Restorer started at 2024-04-04T21:46:06Z
===> RESTORING
[detector] Timer: Detector ran for 148.746086ms and ended at 2024-04-04T21:46:06Z
[detector] google.utils.label-image 0.0.2
[detector] google.java.entrypoint 0.9.0
[detector] google.java.maven 0.9.0
[detector] google.java.runtime 0.9.2
[detector] 4 of 5 buildpacks participating
[detector] Timer: Detector started at 2024-04-04T21:46:06Z
===> DETECTING
Can't seem to get to the bottom of this. I did review:
To run Helloworld deployment via IntelliJ Community into Google Cloud by running gcloud run deploy
on IntelliJ
Based on the error ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51 [builder] ERROR: failed to build: exit status 1
, I think this is more on the configuration of Maven than in GCP. I see three possible common issues:
First, check the correct version of your JDK, you may follow the steps below (blockquote won't format) [1]:
Make sure you're also a proper JDK and not a JRE, which solved the OP's issue.
Next, make sure you're not running Maven as a sudo
, since JAVA_HOME
is getting overriden[2].
Lastly, check your pom.xml
file and explicitly reference the Java version:
<configuration>
<image>
<name>${project.groupId}/payment.service:${project.version}</name>
<env>
<BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
</env>
</image>
</configuration>
You may view the full discussion in this Stack Overflow thread.
[1]. Fatal error compiling: release version 17 not supported
[2]. maven-comiler-plugin: Fatal error compiling: error: release version 17 not supported