Cloud Foundry:如何使用Java Buildpack特定版本

时间:2019-12-03 06:01:19

标签: java spring-boot cloudfoundry pivotal-cloud-foundry

我正在尝试将Spring Boot应用程序部署到Cloud Foundry。我已经在manifest.yml中提供了构建包,如下所示

---
applications:
- name: gl-bo-sample
  path: ./target/gl-1.0-SNAPSHOT.jar
  buildpacks:
      - https://github.com/cloudfoundry/java-buildpack.git

现在我正尝试在特定版本中使用它,我尝试将URL更改为

https://github.com/cloudfoundry/java-buildpack.git#4.26

但低于错误

Staging app and tracing logs...
   Cell 42004a5d-c593-4393-a123-f76cb8abe8b5 creating container for instance 43c3e913-e5a2-4251-b138-1309e117dc23
   Cell 42004a5d-c593-4393-a123-f76cb8abe8b5 successfully created container for instance 43c3e913-e5a2-4251-b138-1309e117dc23
   Downloading app package...
   Downloaded app package (26.2M)
   Failed to clone git repository at https://github.com/cloudfoundry/java-buildpack.git
   Exit status 1
   Cell 42004a5d-c593-4393-a123-f76cb8abe8b5 stopping instance 43c3e913-e5a2-4251-b138-1309e117dc23
   Cell 42004a5d-c593-4393-a123-f76cb8abe8b5 destroying container for instance 43c3e913-e5a2-4251-b138-1309e117dc23
   Cell 42004a5d-c593-4393-a123-f76cb8abe8b5 successfully destroyed container for instance 43c3e913-e5a2-4251-b138-1309e117dc23
Error staging application: Staging error: staging failed
FAILED

尝试添加#v4.26
收到其他错误-

Downloaded app package (26.2M)
   -----> Java Buildpack v4.26 | https://github.com/cloudfoundry/java-buildpack.git#e25d6bf
   [Buildpack]                      ERROR Finalize failed with exception #<RuntimeError: Open Jdk JRE error: No version resolvable for '1.8.0_232' in 1.7.0_06, 1.7.0_07, 1.7.0_08, 1.7.0_09, 1.7.0_10, 1.7.0_11, 1.7.0_12, 1.7.0_13, 1.7.0_14, 1.7.0_15, 1.7.0_17, 1.7.0_21, 1.7.0_25, 1.7.0_40, 1.7.0_45, 1.7.0_51, 1.7.0_55, 1.7.0_60, 1.7.0_65, 1.7.0_71, 1.7.0_75, 1.7.0_79, 1.8.0_00, 1.8.0_05, 1.8.0_11, 1.8.0_20, 1.8.0_25, 1.8.0_31, 1.8.0_40, 1.8.0_45, 1.8.0_51, 1.8.0_60, 1.8.0_65, 1.8.0_71, 1.8.0_73, 1.8.0_77, 1.8.0_91, 1.8.0_91-unlimited-crypto, 1.8.0_101, 1.8.0_111, 1.8.0_121, 1.8.0_131, 1.8.0_141, 1.8.0_144, 1.8.0_152, 1.8.0_161, 1.8.0_162, 1.8.0_172, 1.8.0_181, 1.8.0_191, 1.8.0_192, 1.8.0_201, 1.8.0_202, 1.8.0_212, 1.8.0_222, 1.8.0_RC1, 9.0.0_181, 9.0.1_11, 9.0.4_11, 10.0.0_46, 10.0.1_10, 10.0.2_13, 11.0.0_28, 11.0.1_13, 11.0.2_07, 11.0.2_09, 11.0.3_07, 11.0.4_11, 12.0.0_33, 12.0.1_12, 12.0.2_10>
   Open Jdk JRE error: No version resolvable for '1.8.0_232' in 1.7.0_06, 1.7.0_07, 1.7.0_08, 1.7.0_09, 1.7.0_10, 1.7.0_11, 1.7.0_12, 1.7.0_13, 1.7.0_14, 1.7.0_15, 1.7.0_17, 1.7.0_21, 1.7.0_25, 1.7.0_40, 1.7.0_45, 1.7.0_51, 1.7.0_55, 1.7.0_60, 1.7.0_65, 1.7.0_71, 1.7.0_75, 1.7.0_79, 1.8.0_00, 1.8.0_05, 1.8.0_11, 1.8.0_20, 1.8.0_25, 1.8.0_31, 1.8.0_40, 1.8.0_45, 1.8.0_51, 1.8.0_60, 1.8.0_65, 1.8.0_71, 1.8.0_73, 1.8.0_77, 1.8.0_91, 1.8.0_91-unlimited-crypto, 1.8.0_101, 1.8.0_111, 1.8.0_121, 1.8.0_131, 1.8.0_141, 1.8.0_144, 1.8.0_152, 1.8.0_161, 1.8.0_162, 1.8.0_172, 1.8.0_181, 1.8.0_191, 1.8.0_192, 1.8.0_201, 1.8.0_202, 1.8.0_212, 1.8.0_222, 1.8.0_RC1, 9.0.0_181, 9.0.1_11, 9.0.4_11, 10.0.0_46, 10.0.1_10, 10.0.2_13, 11.0.0_28, 11.0.1_13, 11.0.2_07, 11.0.2_09, 11.0.3_07, 11.0.4_11, 12.0.0_33, 12.0.1_12, 12.0.2_10
   Failed to compile droplet: Failed to run finalize script: exit status 1
   Exit status 223
   Cell 87d0c251-800c-46b8-b342-84120765ba39 stopping instance c9c63305-110d-4688-ae86-7df857a1debd
   Cell 87d0c251-800c-46b8-b342-84120765ba39 destroying container for instance c9c63305-110d-4688-ae86-7df857a1debd
   Cell 87d0c251-800c-46b8-b342-84120765ba39 successfully destroyed container for instance c9c63305-110d-4688-ae86-7df857a1debd
Error staging application: App staging failed in the buildpack compile phase
FAILED
  1. 我做错了什么

2 个答案:

答案 0 :(得分:2)

在buildpack git URL中的锚点应以v为前缀,如

https://github.com/cloudfoundry/java-buildpack#v4.26

请参见https://stackoverflow.com/a/26127753/1299533

答案 1 :(得分:1)

当您在离线和在线buildpack之间切换时会发生这种情况。

请尝试:

  • 清理您的Blobstore缓存cf curl -X DELETE /v2/blobstores/buildpack_cache

  • 使用离线buildpack:

    cf create-buildpack my-custom-java-bp https://github.com/cloudfoundry/java-buildpack#v4.26 100 --enable

然后在清单中引用此buildpack。

P.S。您可以尝试将这两项操作结合在一起,也可以只尝试一次。