Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[go-migration] Compatibility issue with existing apps due to JRE relocation in the Go-based Java Buildpack

未关闭
#1,151 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, java
领域
build-system

调研方向

从 issue 中提到的 buildpack staging 流程和 /profile.d/0_java.sh 入口点开始,然后跟踪新的 JAVA_HOME 在哪里建立。使用硬编码的 .java-buildpack/open_jdk_jre/bin/java 路径重现 staging,并验证两个旧版 JRE 路径都解析到规范位置,同时新的 JAVA_HOME 仍然可用。

由索引模型根据 Issue 内容生成。

描述

Describe the bug
With the new Go-based Java Buildpack, the location of the JRE has changed:
for example, from /home/vcap/app/.java-buildpack/open_jdk_jre to the new location /home/vcap/deps/0/jre/jre-17.0.15/.
There are applications that invoke Java via a hardcoded relative path inside the droplet: .java-buildpack/open_jdk_jre/bin/java so those hardcoded paths no longer exist, which breaks apps and CF tasks that rely on that path. For example, an app used to execute CF Task to execute e.g. the DB schema (so the java is currently being invoked via the full path .java-buildpack/open_jdk_jre/bin/java). Or usages like JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR

The new Go-based buildpack has a way to introduce $JAVA_HOME which will do the job but only for new apps (the existing apps pointing to /home/vcap/app/.java-buildpack/open_jdk_jre will fail).

Reproduction steps

  • Use an app/script that calls Java using the relative path inside the droplet, e.g.:
    .java-buildpack/open_jdk_jre/bin/java -Xms123M org.springframework.boot.loader.launch.JarLauncher
  • Stage the app using the current or the Go-migration branch of the buildpack.
  • Run the app or run a CF task that invokes the hardcoded path.
  • Observe that the app fails with No such file or directory

Expected behavior
Existing apps/CF Tasks could continue to run without modification, even if the buildpack internal JRE layout changes.

Suggested solution
Introduce compatibility shims during staging:

export JAVA_HOME=<the-new-java-location> (available in /profile.d/0_java.sh)
mkdir -p /home/vcap/app/.java-buildpack
ln -s $JAVA_HOME /home/vcap/app/.java-buildpack/open_jdk_jre
ln -s $JAVA_HOME /home/vcap/app/.java-buildpack/sap_machine_jre
  • This preserves .java-buildpack/open_jdk_jre and .java-buildpack/sap_machine_jre as a symlink to the actual JRE location.
  • $JAVA_HOME points to the canonical new location.
  • Apps with hard-coded paths will continue working.
主要语言
Go
星标
452
派生
2.5k
平均合并
1 天 5 小时
30 天内合并 PR
20

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudfoundry/java-buildpack 的其他 Issue

查看 cloudfoundry/java-buildpack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。