How inject your Maven settings.xml at folder level with the Credentials plugin?

Article ID:204264974
1 minute readKnowledge base

Issue

  • Want to inject the secret settings.xml at folder level to have it available for the jobs inside the folder

Environment

  • CloudBees Jenkins Enterprise

This does not work in CloudBees Jenkins Operations Center. This only works with CloudBees Jenkins Enterprise and Jenkins LTS/OSS releases.

Resolution

Following plugins need to be installed in your CloudBees Jenkins Enterprise instance:

Then, let’s say you have a folder called maven-folder in your instance.

folder.png

As you might already know, you are able to use the credential plugin at folder level. So all you need to inject a secret file.

folder-credentials.png

Now, at job level you need to create a bind in which you will specify the variable you would like to use.

binding.png

Finally, the only thing we still need to do is to tell maven to use the secret file.

mvn-setup.png

Now, when you build you can see the secret file is correctly injected.

console-output.png