How to add Github authentication to Maven Release Plugin

If you are trying to configure the Maven Release plugin for you project, you might wander how you add the github credentials to the plugin when it trying to push a commit to the github. Well you have to put them in settings.xml in maven not in the project.

So first of all where is the settings.xml is? it reside in maven folder inside conf directory. ( maven -> conf -> settings.xml )

Next is how we define our credentials there? AsĀ (https://maven.apache.org/settings.html#Servers) says we have to define them insideĀ <servers> tags as below

<server>
<id>githubcredentials</id>
<username>githubusername</username>
<password>githubpassword</password>
</server>

now we have to add a property indicating that into pom.xml. So Maven release plugin will get it. It should like below.

<properties>
<project.scm.id>githubcredentials</project.scm.id>
</properties>

id should be same one you put in settings.xml. Now run Maven release plugin to check it works correctly.

 

 

 

Advertisements