Where to save the setting-security.xml file to use Maven encryption?


We are using TeamCity 8.0.4 and the default bundled Maven version 3.0.5

In the build, we are using Maven to interact with a Nexus server.

We would like to encrypt the password in the Maven settings.xml file as described in this article:

This requires a settings-security.xml file which should be in the same folder as the Maven settings.xml one.
The setting.xml file is saved in TeamCity, and deployed to the server as a custom "User settings selection" file - so I don't know where it is being deploy to on the agent.

Where should we save the settings-security.xml file ?
Should this be manually deployed to all the agents? and if so, in which folder should it be?
(We have both Windows and Linux agents)

I'm not sure what is the best practice to use an encrypted Maven password in TeamCity, so I'd appriciate any help.

Thanks and happy holidays to you all,

Comment actions Permalink

Hello Eyal,

I apologize for the delay in reply caused by holidays,

TeamCity has no dedicated support for this maven feature yet. I have filed feature request here:  https://youtrack.jetbrains.com/issue/TW-39595 Please, watch/vote for it

Proper workaround would be to place security-settings.xml on each build agent (as this file is by design not to be shared in VCS or CI server), then define an agent property pointing to the file
(see this instruction), e.g.:


Refer to the defined parameter in your Maven build step configuration in "Additional Maven command line parameters" like this:


Please note, that the configuration will only run on those agents, where "path.to.maven.security" is defined.

Comment actions Permalink

Hi Nikita,

Thanks for your reply.

Not an ideal solution, but I'll manage with it...



Please sign in to leave a comment.