Skip to content

Instantly share code, notes, and snippets.

@entzik
Created October 28, 2019 16:54
Show Gist options
  • Save entzik/dfb3dce6dd593005648e9e37a87bcf50 to your computer and use it in GitHub Desktop.
Save entzik/dfb3dce6dd593005648e9e37a87bcf50 to your computer and use it in GitHub Desktop.
Publishing configuration for maven central
val MAVEN_UPLOAD_USER: String by project
val MAVEN_UPLOAD_PWD: String by project
publishing {
repositories {
maven {
name = "MavenCentral"
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
username = MAVEN_UPLOAD_USER
password = MAVEN_UPLOAD_PWD
}
}
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("Your Library Name")
description.set("Short description of your library")
url.set("https://your.libra.ry/home/page")
licenses {
license {
name.set("Licence Name")
url.set("http://link.to/full/license/text")
}
}
developers {
developer {
id.set("some social id")
name.set("Your Full Name")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:https://github.com/your/project.git")
developerConnection.set("scm:git:https://github.com/your/project.git")
url.set("https://your-library-web-site.domain")
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment