Where token is your personal access token.
<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">
<servers>
<server>
<id>github</id>
<username>GITHUB_USERNAME</username>
<password>GITHUB_TOKEN</password>
</server>
</servers>
</settings>
$ mvn deploy:deploy-file \
-Dfile=/path/to/file.aar \
-DpomFile=/path/to/file.pom \
-DrepositoryId=github \
-Durl=https://maven.pkg.github.com/OWNER/REPO
Add your maven credentials to your project like you would for any other password protected package registry.
allprojects {
repositories {
maven {
url 'https://maven.pkg.github.com/OWNER/REPO'
credentials {
username = project.findProperty("mvn.github.user") ?: System.getenv("USERNAME")
password = project.findProperty("mvn.github.token") ?: System.getenv("TOKEN")
}
}
}
}
Note: The Gradle Maven plugin doesn't read from settings.xml so configuring a profile with a repository in
~/.m2/settings.xml
won't do any good: gradle/gradle#1236