Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 595
Tristan Van Poucke Avatar asked Aug 12 '18 12:08

Tristan Van Poucke


People also ask

Does Google Cloud support Java?

Google Cloud lets you choose the best environment to run your Java applications, with options for serverless, Kubernetes, VMs, or custom hardware. Native image support also provides enhanced performance for your applications.

Which version of Java does Google App Engine Support?

App Engine runs Java 11/17 apps in a container secured by gVisor on an up-to-date Ubuntu Linux distribution and its supported openjdk-11-jdk for Java 11 or openjdk-17-jdk for Java 17 runtime.

What is GCP Java?

GCP offers a scalable range of computing services, such as: Google App Engine: It is a cloud computing platform that follows the concept of Platform-as-a-Service to deploy PHP, Java and other software. It is also used to develop and deploy web-based software in Google-managed data centers.


1 Answers

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.

After that, you can push this builder and use it in your pipeline.


https://github.com/carlossg/docker-maven The repo doesn't seem to contain Java 9 anymore.

like image 155
Mangu Avatar answered Sep 22 '22 19:09

Mangu