Setting PATH variable in BuildWrapper

18 views
Skip to first unread message

Nikhil Bhoski

unread,
Jan 20, 2020, 1:47:33 AM1/20/20
to Jenkins Developers
Hi ,

I want to set the PATH variable during setup() of BuildWrapper. and use the tools for which i am setting path directly on command line during my build step (Builder class). I am trying to set the env variable using below in setup() method of Build Wrapper

initialEnvironment.put("mytoolRoot", getMytoolRoot + nodeSpecificFileSep + "bin");
initialEnvironment.override("PATH+mytoolRoot",initialEnvironment.get("mytoolRoot") );

and then just to test i am calling my tool through command line directly using Launcher in same setup() method like below 

launcher.launch().cmdAsSingleString("mytool -batch -ver").env(initialEnvironment).stdout(listener).join();

above command fails to pick up the tool directly through the command line. and the build fails with error Cannot run program "mytool" no such file or directory. 

what can i do to set the env variable . the other option i am trying is to write batch and shell script file and execute it. but i am not sure if i should do that. 

Thanks & Regards
Nikhil 

Nikhil Bhoski

unread,
Jan 21, 2020, 2:19:38 AM1/21/20
to Jenkins Developers
Any help on this would be appreciated  
Reply all
Reply to author
Forward
0 new messages