1Mojojojo1
1Mojojojo1

Reputation: 173

How to override user.home property of ant from Jenkins server?

Hi I need some help in overriding the user.home property of ant from Jenkins. I created a simple job on jenkins that runs a build script on a slave machine of the master. One of the tasks of the scripts is to use the user.home property of ant and access certain files. The problem is that when I try to echo this property from the command line of the slave machine, I see C:\Users\Administrator but when I run the exact the same script from the Jenkins server I see C:\ . This difference is causing the build to fail on Jenkins. Can anyone please tell me what is the reason for this difference? Is there any way I can override this?

I tried having a property called user.home in the config file of my job but it doesn't seem to pick it up. Another interesting point is that when I changed the user.home value to some gibberish in the config file and run ant from command line on the slave, it still picks it up as C:\Users\Administrator

I am using ant 1.7.1 and Jenkins 1.598

Upvotes: 0

Views: 1030

Answers (1)

thekbb
thekbb

Reputation: 7924

You likely have jenkins running as a different ID than Administrator. Which is a good thing.

Properties in ant are immutable so you can specify those properties from the ant plugin in jenkins and they'll override any other values. (click advanced under the invoke ant buildstep to see the properties text box).

I'd recommend you not override user.home but rather refactor your ant so there is a config.location property that defaults to user.home but can be overidden to whatever you want from jenkins. It just seems unnatural to ovrride user.home

Upvotes: 1

Related Questions