Gradle 4+ with Kotlin DSL
Step 1: Create your Personal Access Token using this site
It requires 2 scopes read:packages
and write:packages
. When your repository is private repo
scope is required too.
For more about configuring for Maven use this link
plugins {
id "com.github.registry" version "0.1.0"
}
plugins {
id("com.github.registry") version "0.1.0"
}
github {
token = '<your personal access token here>' // is required to uploading your artifacts
publications = ['MyPublication']
repositoryOwner = '<repository owner>' // required if your repository owner is a different as your personal access token
}
publishing {
publications {
MyPublication(MavenPublication) {
artifactId = archivesBaseName
from(components.java)
artifact(sourcesJar)
artifact(javadocJar)
artifact(kdocJar)
}
}
}
github {
token = "<your personal access token here>" // is required to uploading your artifacts
publications = arrayOf("MyPublication")
repositoryOwner = "<repository owner>" // required if your repository owner is a different as your personal access token
}
publishing {
publications {
register("MyPublication", MavenPublication::class) {
artifactId = base.archivesBaseName
artifact(tasks.named<Jar>("sourcesJar").get())
artifact(tasks.named<Jar>("javadocJar").get())
artifact(tasks.named<Jar>("kdocJar").get())
from(components["java"])
}
}
}