Skip to content

Commit

Permalink
Use Gradle Nexus Publish Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Feb 26, 2024
1 parent 9a9a90a commit 18e18f7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,13 @@ class SonatypePlugin : Plugin<Project> {
from(tasks.findByName("javadoc") ?: tasks.findByName("dokka"))
}

val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(project.the<SourceSetContainer>()["main"].allSource)
configure<JavaPluginExtension> {
withSourcesJar()
}

configure<PublishingExtension> {
publications.create<MavenPublication>("sonatype") {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
}
}
Expand All @@ -238,7 +236,7 @@ class SonatypePlugin : Plugin<Project> {
}

tasks.withType<InitializeNexusStagingRepository> {
shouldRunAfter(tasks.withType<Sign>())
mustRunAfter(tasks.withType<Sign>())
}
}
}
Expand Down

0 comments on commit 18e18f7

Please sign in to comment.