如何在 Windows 上的 Jenkins 配置中设置 PATH 环境变量? [英] How to set the PATH environment variable in Jenkins configuration on Windows?

查看:60
本文介绍了如何在 Windows 上的 Jenkins 配置中设置 PATH 环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Windows Server 2008 上运行我的构建过程时,它失败并显示类似的错误消息

When I run my build process on Windows Server 2008, it fails with the error message like

无法运行程序foo":CreateProcess:error=2,系统找不到指定的文件

Cannot run program "foo": CreateProcess: error=2, The system cannot find the file specified

我已经在 Ubuntu Server 上遇到了类似的问题,并通过将 Composer 全局安装的二进制文件的文件夹的路径添加到 Jenkins 配置中的 PATH 变量(Manage Jenkins -> Configure System -> 全局属性-> 环境变量:name=PATH, value=$PATH:$COMPOSER_HOME/vendor/bin/):

I've already had a similar issue on Ubuntu Server and resolved it by adding the path to the folder with the binaries installed globally by Composer to the PATH variable in Jenkins config (Manage Jenkins -> Configure System -> Global properties -> Environment variables: name=PATH, value=$PATH:$COMPOSER_HOME/vendor/bin/):

(由于将 COMPOSER_HOME 移到 /root 目录之外的权限,还需要另一个可供 Jenkins 访问的目录.)

(Due to a permissions moving COMPOSER_HOME outside of the /root directory was also needed to another one, accessible for Jenkins, was also needed.)

现在我在 Windows 上尝试了相同的方法,但它不起作用.所以,也许我只是设置了 PATH 错误.我试过的:

Now I tried the same on Windows, but it doesn't work. So, maybe I'm just setting the PATH wrong. What I've tried:

PATH
$PATH:D:path	oCOMPOSER_HOMEvendorin

PATH
$PATH;D:path	oCOMPOSER_HOMEvendorin

PATH
%PATH%D:path	oCOMPOSER_HOMEvendorin

PATH
%PATH%;D:path	oCOMPOSER_HOMEvendorin

如何在 Jenkins 配置中设置 PATH 环境变量在 Windows 上正确工作?

How to set the PATH environment variable in Jenkins configs correctly working on Windows?

推荐答案

我遇到的问题不是由错误的 Path 配置引起的.%PATH%;D:path oCOMPOSER_HOMEvendorin 正确.

The issue I had was caused not by a wrong Path configuration. %PATH%;D:path oCOMPOSER_HOMEvendorin is correct.

这篇关于如何在 Windows 上的 Jenkins 配置中设置 PATH 环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆