windows 如何在 hudson 服务器的从站中配置 java.home?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6984249/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:44:50  来源:igfitidea点击:

How do I configure the java.home in a slave of a hudson server?

windowshudsonjava-homeslave

提问by Winston Chen

I am using a windows box to run the slave for my husdon. But I haven't found any effect way to configure JAVA_HOME and PATH for java on the box.

我正在使用 Windows 框为我的 husdon 运行奴隶。但是我还没有找到任何有效的方法来为盒子上的java配置JAVA_HOME和PATH。

Does anyone know how I am able to do this?

有谁知道我怎么能做到这一点?

回答by Joachim Sauer

You can configure where Jenkins/Hudson should search for the JDK on the slave on the slave configuration page.

您可以在从机配置页面上配置 Jenkins/Hudson 应该在从机上搜索 JDK 的位置。

Check "Tool Locations", Click "Add", select the JDK from the List and type the path to the JDK in the "Home" text field below.

选中“工具位置”,单击“添加”,从列表中选择 JDK 并在下面的“主页”文本字段中键入 JDK 的路径。

If JDK isn't showing up in the Tool Locations list,it may be because you need to configure a JDK globally first. To do this, check the "JDK" section in your global configuration page.

如果 JDK 未显示在 Tool Locations 列表中,可能是因为您需要先全局配置 JDK。为此,请检查全局配置页面中的“JDK”部分。

回答by Pedro Trujillo

You can update your Jenkins version, it will solve it. Otherwise this worked for me (Jenkins 1.6, build/test node: MacOSX Mojave):

您可以更新您的 Jenkins 版本,它会解决它。否则这对我有用(Jenkins 1.6,构建/测试节点:MacOSX Mojave):

First install java 8 in your build/test nodeusing the commands:

首先使用以下命令在您的构建/测试节点中安装 java 8 :

brew update
brew cask install caskroom/versions/java8

Then in Jenkins web panel click on your build/test node, then click on Configureand then click in the Advanced...button, this will show you multiple text fields. Then in the JavaPath field add the path to your java 8.

然后在 Jenkins web 面板中单击您的构建/测试节点,然后单击配置,然后单击高级...按钮,这将显示多个文本字段。然后在 JavaPath 字段中添加到您的 java 8 的路径。

enter image description here

在此处输入图片说明

For me this path is like:

对我来说,这条路就像:

/Library/Java/JavaVirtualMachines/jdk1.8.X_XXX.jdk/Contents/Home/bin/java

/Library/Java/JavaVirtualMachines/jdk1.8.X_XXX.jdk/Contents/Home/bin/java

Note:remember replace X_XXXwith your java 8 version before.

注意:记得X_XXX之前用你的 java 8 版本替换。

Then Save.

然后保存

After that disconnect the build/test node and connect it again. This should solve the problem.

之后断开构建/测试节点并再次连接。这应该可以解决问题。