maven - 找不到 Artifact -Cloud Builder步骤失败(Google Cloud Builder)

标签 maven gradle google-cloud-platform google-container-builder

Google容器构建器步骤之一失败,因为它取决于上一步生成的文件。

buildspec中的所有步骤都在一台机器上执行吗?请建议是否有更好的方法来执行此操作,或者是否需要在构建规范中添加任何额外的步骤?

buildspec:

steps:
- name: 'gcr.io/cloud-builders/mvn'
  args: ['install:install-file', '-Dfile=locallib/wlthint3client.jar', '-DgeneratePom=true',  '-DgroupId=com.oracle.weblogic', '-DartifactId=wlthint3client', '-Dversion=10.3', '-Dpackaging=jar']
- name: 'gcr.io/cloud-builders/gradle'
  args: ['build']

步骤0:直接在Maven本地仓库中安装JAR

步骤1:依赖此JAR的Gradle构建

在Cloud Builder的日志下方,其中步骤0成功,而步骤1未成功,步骤1无法找到步骤0安装的jar:
Step #0: [INFO] Installing /workspace/locallib/wlthint3client.jar to /root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #0: [INFO] Installing /tmp/mvninstall2626838898258363583.pom to /root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #0: [INFO] ------------------------------------------------------------------------
Step #0: [INFO] BUILD SUCCESS
Step #0: [INFO] ------------------------------------------------------------------------
Step #0: [INFO] Total time: 3.529 s
Step #0: [INFO] Finished at: 2018-01-24T05:11:36Z
Step #0: [INFO] Final Memory: 10M/56M
Step #0: [INFO] -
Step #1: * What went wrong:
Step #1: Could not resolve all dependencies for configuration ':detachedConfiguration5'.
Step #1: > Could not find com.oracle.weblogic:wlthint3client:10.3.
Step #1:   Searched in the following locations:
Step #1:       file:/root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #1:       file:/root/.m2/repository/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #1:       https://repo1.maven.org/maven2/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.pom
Step #1:       https://repo1.maven.org/maven2/com/oracle/weblogic/wlthint3client/10.3/wlthint3client-10.3.jar
Step #1:   Required by:
Step #1:       project :
Step #1:**

最佳答案

以我的经验,我在Google容器构建器中了解到,每个构建步骤都在不同的VM中执行。因此,我通过修改构建规范解决了上述问题。

只需一步即可构建规格,以上传 Artifact 并构建项目。

 steps:
 - name: 'gcr.io/cloud-builders/gradle'
   args: ['uploadResultArchives','build']

关于maven - 找不到 Artifact -Cloud Builder步骤失败(Google Cloud Builder),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48415628/

相关文章:

maven - pig-0.9.0.pom 不包含其所有运行时依赖项,如 pig-0.8.1-cdh3u1.pom

maven - mvn 部署到 AWS(通过 distributionManagement ssh)

go - 如何访问云构建器中的私有(private) Github 存储库?

google-app-engine - 我们可以在没有 Google 自动缩放器的情况下在 Google 云计算上扩展应用程序吗?

firebase - 与不使用通配符和 _TABLE_SUFFIX 相比,BigQuery -firebase 导出的工作方式有所不同

java - 带有 java 和 groovy 源文件夹的 Maven 项目,如何在 POM 中表示

maven - 是否有从 Maven 到 Bazel 的迁移路径?

java - Android Gradle非法规则

java - Asciidoctor gradle 插件

java - 命令 "gradle jettyRunWar"在 Ubuntu 上不起作用