Google cloud builder - Java version
Google cloud builder - Java version
I am trying to create a build pipeline with Google cloud builder. I started off with something very simple: "mvn clean deploy", the cloudbuild.yaml I am using looks like this:
steps:
# Build the application with maven
- name: 'gcr.io/cloud-builders/mvn'
args: ['clean', 'deploy']
This seems to be working, the maven deploy is started but eventually I run into an error while compiling:
Step #1: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-
compiler-plugin:3.1:compile (default-compile) on project codex-core-model:
Fatal error compiling: invalid target release: 1.9 -> [Help 1]
My project is written in java 9, so I will have to compile it using jdk9. Apparently the mvn builder uses jdk8, I checked for certainty using "mvn --version" and had these results:
Step #1: Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-
04-03T19:39:06Z)
Step #1: Maven home: /usr/share/maven
Step #1: Java version: 1.8.0_171, vendor: Oracle Corporation
Step #1: Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Step #1: Default locale: en_US, platform encoding: ANSI_X3.4-1968
Step #1: OS name: "linux", version: "4.4.0-130-generic", arch: "amd64",
family: "unix"
My question: Is there an easy way to make this builder use jdk9 instead of jdk8?
Looking for an answer drawing from credible and/or official sources.
1 Answer
1
There is no available Cloud Builder image in GCP with Java 9, you can see the latest source right here.
But you can always submit your own building steps. If you check the Cloud Build for Maven, you can see that you will need to build first, your own mvn
image, like this one, pushed into gcr.io
.
mvn
gcr.io
After that, you can push this builder and use it in your pipeline.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.