Skip to content

How to add aadarchi.github.token

Sese edited this page Oct 12, 2022 · 4 revisions

GithubProducer class in Github SCM Handler load api client in initialization. You have to define the property CONFIG_GITHUB_PROPERTY. This github token is set through aadarchi.github.token system property.

To define this property, you have to :

  • generate an access token on github
  • add your access token on settings.xml

* First step : Generate your personal access token in Github

In github, go to :

  • Settings
  • Developer settings
  • Personal access tokens
  • generate a new token: give a description name and select the scope you want to use.

Create a personal access token

* Second step : Add your personal access token in your settings.xml

Your settings.xml can be in :

  • ${maven.home}/conf/settings.xml
  • ${user.home}/.m2/settings.xml

To find which settings.xml file is used, you can run mvn -X clean | grep "settings" command line. To find effective settings, you can run mvn help:effective-settings command line.

settings.xml in Maven

If you don't have a settings.xml file, you can create it through your pom.xml: Right click to your pom.xml -> go to Maven -> create settings.xml.

  • In profile section : create a profile
  • In properties section : add your github login and personal access token properties and values
  • In activeProfiles section : activate your profile

settings.xml :

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
   <localRepository />
   <interactiveMode />
   <offline />
   <pluginGroups />
   <servers/>
   <proxies />
   <profiles>
      <profile>
          <id>profile name</id>
          <properties>
             <aadarchi.github.login>username</aadarchi.github.login>
             <aadarchi.github.token>token</aadarchi.github.token>
          </properties>
      </profile>
   </profiles>
   <activeProfiles>
       <activeProfile>profile</activeProfile>
   </activeProfiles>
</settings>

settings.xml details