Issue
When building a Maven job on a windows agent configured as service the user.home
java system property is pointing to c:\
thus Maven is looking for user’s settings under c:\.m2\settings.xml
, c:\.m2\security-settings.xml
and it is storing the local repository in c:\.m2\repository\
.
Resolution
When a Jenkins agent is installed on windows as a service it configured to run as Local system account


This isn’t a real account on the server, that’s why Maven defines the user’s home (user.home
java system property) as c:\
If you reconfigure your service to be launch with a real account (Adminsitrator
below)

Then Maven correctly defines the user’s home as C:\Users\Administrator
To properly manage your Maven settings accross agents it is recommended to use the Config File Provider Plugin which allows to centralize the management of these configuration files in your controller and to automatically deploy them in your agents to let Maven use them transparently. |