简体   繁体   English

Bamboo 使用 JAVA_HOME 失败应该指向 CentOS 7 上 Maven 任务中的 JDK 而不是 JRE

[英]Bamboo fails with JAVA_HOME should point to a JDK not a JRE in Maven task on CentOS 7

I am running Bamboo on CentOS 7. My JAVA_HOME/bin/java and java commands refer to the same thing, and they are set properly:我在 CentOS 7 上运行 Bamboo。我的JAVA_HOME/bin/javajava命令指的是同一件事,并且它们设置正确:

~$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre
~$ 

I am also setting my JAVA_HOME variable in .bash_profile .我还在.bash_profile中设置我的JAVA_HOME变量。 I have put it in <bamboo installation dir>/bin/setenv.sh too.我也把它放在<bamboo installation dir>/bin/setenv.sh中。 However, in my Maven tasks in Bamboo fail with:但是,在我在 Bamboo 中的 Maven 任务中失败了:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

I don't know how to debug this and how can I provide any further information.我不知道如何调试它以及如何提供任何进一步的信息。 When I ssh into the server that Bamboo is installed, I can run mvn commands without any issues.当我 ssh 进入安装了 Bamboo 的服务器时,我可以运行mvn命令而没有任何问题。

So, it is not about how you set the JAVA_HOME variable for Bamboo, but it's about how Bamboo sets its JAVA_HOME variable for it's java executable.因此,这不是关于如何为 Bamboo 设置JAVA_HOME变量,而是关于 Bamboo 如何为其 java 可执行文件设置其JAVA_HOME变量。 It is in the database.它在数据库中。 It was the value before I made an update to java and deleted the old version and I have changed it from Bamboo administration > JDKs to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre and done, the issue is resolved.这是我更新 java 并删除旧版本之前的值,我已将其从Bamboo administration > JDKs更改为/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre完成,问题解决。

The problem can be not in the agent configuration, but in the Plan.问题可能不在代理配置中,而在计划中。

Go to Configure Plan -> Stages -> Default Job and then in the Task itself edit the Environment variables ex.转到配置计划 -> 阶段 -> 默认作业,然后在任务本身中编辑环境变量 ex。 JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-1.el7_9.x86_64" JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-1.el7_9.x86_64"

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

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