如何在Windows上的Jenkins配置中设置PATH环境变量

如何在Windows上的Jenkins配置中设置PATH环境变量

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

问题描述

当我在Windows Server 2008上运行我的构建过程时,它会失败,出现错误信息,如

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





(由于权限移动 COMPOSER_HOME 另外还需要 / root 目录,对于Jenkins来说也是可以的。)



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

  PATH 
$ PATH:D:\path\to\COMPOSER_HOME\\ \\ vendor\bin

PATH
$ PATH; D:\path\to\COMPOSER_HOME\vendor\bin

PATH
%PATH%D:\path\to\COMPOSER_HOME\vendor\bin

PATH
%PATH%; D:\path\to\COMPOSER_HOME\\ \\ vendor\bin

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

解决方案

我所造成的问题不是由错误的路径配置。 %PATH%; D:\path\to\COMPOSER_HOME\vendor\bin 正确。




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

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/):

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

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\to\COMPOSER_HOME\vendor\bin

PATH
$PATH;D:\path\to\COMPOSER_HOME\vendor\bin

PATH
%PATH%D:\path\to\COMPOSER_HOME\vendor\bin

PATH
%PATH%;D:\path\to\COMPOSER_HOME\vendor\bin

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

解决方案

the issue I had was caused not by a wrong Path configuration. %PATH%;D:\path\to\COMPOSER_HOME\vendor\bin is correct.

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

08-01 06:18