1

I am trying to load env variables using EnvInject Plugin and not able to do so

enter image description here

Jill448
  • 1,745
  • 10
  • 37
  • 62

2 Answers2

2

Your are injecting the variables after execute the script, you should move the "Inject Enviroment Variables" step before the "Execute Shell"

victormpav
  • 76
  • 3
  • I moved them, and got a message `Variables injected successfully.`, but where can I see them? Tried looking at "Environment variables" inside my job , but they are not present – Jill448 Mar 21 '16 at 20:08
  • You want load from env.propeties the variable "VISUALSTUDIOVERSION"? – victormpav Mar 21 '16 at 20:14
  • Yes,I am looking to add more env variables like LIB and PATH once I could load these – Jill448 Mar 21 '16 at 20:31
  • Ok, to see the value of variable that you have load from env.properties. You should change the script in "Execute Shell" by: `echo %VISUALSTUDIOVERSION%` This should log in your output log `12.0` – victormpav Mar 21 '16 at 20:43
  • I added `VISUALSTUDIOVERSION=12.0` in `env.properties`. and added this value `$WORKSPACE\env.properties` at properties file path and modified "Execute Shell" to echo %VISUALSTUDIOVERSION% >> $WORKSPACE\env.properties . Still Cant see anything in console output, but the value got reflected in environment variables tab. – Jill448 Mar 21 '16 at 21:08
  • Which the command `echo %VISUALSTUDIOVERSION% >> $WORKSPACE\env.properties`you are writing the VISUALSTUDIOVERSION variable in the file env.properties. If you want see the value of the property VISUALSTUDIOVERSION in the Jenkins console output you should write only the command: `echo %VISUALSTUDIOVERSION`Which this command you should see in the console log the value of the variable – victormpav Mar 22 '16 at 07:53
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/106988/discussion-between-victormpav-and-jill448). – victormpav Mar 22 '16 at 08:07
-1

The problem is you can't have a dot '.' in the file name. Change "env.properties" to "props" for example.