Where to save setup-security.xml to use Maven encryption?

We use TeamCity 9.1 and the standard Maven version 3.0.5 by default

In the assembly, we use Maven to interact with the Nexus server.

We would like to encrypt the password in the Maven settings.xml settings file, as described in this article: http://maven.apache.org/guides/mini/guide-encryption.html

This requires the settings-security.xml file, which should be in the same folder as the Maven settings.xml file. The settings.xml file is saved in TeamCity and is deployed on the server as a user file "Select user settings", so I do not know where it is deployed on the agent.

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

I'm not sure that it is best to use Maven's encrypted password in TeamCity, so I would recommend any help.

thanks

+9
source share
1 answer

"I do not know where it is deployed to the agent." You can find this in the output of the build log. Just find the settings .. Using the User Settings file , they are usually stored in the temp directory in the build agent.

When you try to encrypt your password using (in accordance with the encryption guide ):

mvn --encrypt-password my_password 

He expects to find: settings-security.xml; if not, you will receive.

 [ERROR] Error executing Maven. [ERROR] java.io.FileNotFoundException: /home/krbuild/.m2/settings-security.xml (No such file or directory) [ERROR] Caused by: /home/krbuild/.m2/settings-security.xml (No such file or directory) 

Thus, the security file must be stored in each agent on which you intend to run the assembly configuration (and not in VCS). There is still no special support for this feature; see TW-39595

The job should be to set the agent property, for example.

 path.to.maven.security=/path/to/file/security-settings.xml 

Then refer to it in the Maven build step:

 -Dsettings.security=%path.to.maven.security% 
+3
source

Source: https://habr.com/ru/post/1234507/


All Articles