简体   繁体   English

Google云构建器 - Java版本

[英]Google cloud builder - Java version

I am trying to create a build pipeline with Google cloud builder. 我正在尝试使用Google云构建器创建构建管道。 I started off with something very simple: "mvn clean deploy", the cloudbuild.yaml I am using looks like this: 我开始时非常简单:“mvn clean deploy”,我使用的cloudbuild.yaml看起来像这样:

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: 这似乎工作,maven部署已启动,但最终我在编译时遇到错误:

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. 我的项目是用java 9编写的,所以我必须使用jdk9编译它。 Apparently the mvn builder uses jdk8, I checked for certainty using "mvn --version" and had these results: 显然mvn构建器使用jdk8,我使用“mvn --version”检查确定性,并得到以下结果:

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? 我的问题:是否有一种简单的方法可以使这个构建器使用jdk9而不是jdk8?

There is no available Cloud Builder image in GCP with Java 9, you can see the latest source right here . 使用Java 9在GCP中没有可用的Cloud Builder映像,您可以在此处查看最新的源代码。

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 . 如果您检查Cloud Build for Maven,您可以看到您需要首先构建自己的mvn映像,就像这样 ,将其推送到gcr.io

After that, you can push this builder and use it in your pipeline. 之后,您可以推送此构建器并在管道中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM