-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use
gradle-maven-publish-plugin
as it creates staging repository it…
…self and doesn't rely on auto-staging
- Loading branch information
Showing
5 changed files
with
50 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,81 +2,49 @@ | |
* Copyright (c) 2023-2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
val sonatypeUsername: String? by project | ||
val sonatypePassword: String? by project | ||
import com.vanniktech.maven.publish.* | ||
|
||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
|
||
signing { | ||
isRequired = sonatypeUsername != null && sonatypePassword != null | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign(publishing.publications) | ||
plugins { | ||
id("com.vanniktech.maven.publish.base") | ||
} | ||
|
||
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } | ||
|
||
// this is somewhat a hack because we have single javadoc artifact which is used for all publications | ||
tasks.withType<Sign>().configureEach { dependsOn(javadocJar) } | ||
tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(tasks.withType<Sign>()) } | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "snapshot" | ||
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
mavenPublishing { | ||
publishToMavenCentral(SonatypeHost.S01) | ||
signAllPublications() | ||
|
||
pom { | ||
name.set(project.name) | ||
description.set(provider { | ||
checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" } | ||
}) | ||
url.set("https://github.com/whyoleg/cryptography-kotlin") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
maven { | ||
name = "mavenCentral" | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
credentials { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
developers { | ||
developer { | ||
id.set("whyoleg") | ||
name.set("Oleg Yukhnevich") | ||
email.set("[email protected]") | ||
} | ||
} | ||
maven { | ||
name = "projectLocal" | ||
url = uri(rootProject.layout.buildDirectory.dir("mavenProjectLocal")) | ||
} | ||
} | ||
|
||
publications.withType<MavenPublication>().configureEach { | ||
artifact(javadocJar) | ||
pom { | ||
name.set(project.name) | ||
description.set(provider { | ||
checkNotNull(project.description) { "Project description isn't set for project: ${project.path}" } | ||
}) | ||
scm { | ||
connection.set("https://github.com/whyoleg/cryptography-kotlin.git") | ||
developerConnection.set("https://github.com/whyoleg/cryptography-kotlin.git") | ||
url.set("https://github.com/whyoleg/cryptography-kotlin") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("whyoleg") | ||
name.set("Oleg Yukhnevich") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("https://github.com/whyoleg/cryptography-kotlin.git") | ||
developerConnection.set("https://github.com/whyoleg/cryptography-kotlin.git") | ||
url.set("https://github.com/whyoleg/cryptography-kotlin") | ||
} | ||
} | ||
} | ||
} | ||
|
||
// javadocJar setup | ||
// we have a single javadoc artifact which is used for all publications, | ||
// and so we need to manually create task dependencies to make Gradle happy | ||
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") } | ||
tasks.withType<Sign>().configureEach { dependsOn(javadocJar) } | ||
tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(tasks.withType<Sign>()) } | ||
publishing.publications.withType<MavenPublication>().configureEach { artifact(javadocJar) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters