diff --git a/build.gradle.kts b/build.gradle.kts index f4b28c7..6e33a6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ +import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.MavenPublishPlugin import com.vanniktech.maven.publish.SonatypeHost import org.jetbrains.dokka.gradle.DokkaPlugin plugins { java - `maven-publish` - alias(libs.plugins.nexus) + alias(libs.plugins.nexus) apply false alias(libs.plugins.kotlin) apply false alias(libs.plugins.dokka) apply false } @@ -26,14 +26,26 @@ subprojects { toolchain { languageVersion = JavaLanguageVersion.of(8) } - withJavadocJar() - withSourcesJar() + } + + tasks { + val javadocJar by creating(Jar::class) { + dependsOn("javadoc") + archiveClassifier.set("javadoc") + from(javadoc) + } + + val sourcesJar by creating(Jar::class) { + dependsOn("classes") + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) + } } val projectName = project.property("artifact-id") as String val signRequired = project.hasProperty("sign-required") - mavenPublishing { + extensions.configure { coordinates(project.group.toString(), projectName, project.version.toString()) publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) if (signRequired) { diff --git a/kotlin/extensions/build.gradle.kts b/kotlin/extensions/build.gradle.kts index b1a1e8a..0a5d986 100644 --- a/kotlin/extensions/build.gradle.kts +++ b/kotlin/extensions/build.gradle.kts @@ -1,9 +1,3 @@ dependencies { compileOnly(project(":common")) } - -tasks { - javadocJar { - from(dokkaJavadoc.map { it.outputs }) - } -} diff --git a/kotlin/protobuf/build.gradle.kts b/kotlin/protobuf/build.gradle.kts index 9069fbe..ec909e7 100644 --- a/kotlin/protobuf/build.gradle.kts +++ b/kotlin/protobuf/build.gradle.kts @@ -9,9 +9,3 @@ dependencies { compileOnly(libs.kotlinx.serialization.core) compileOnly(libs.kotlinx.serialization.protobuf) } - -tasks { - javadocJar { - from(dokkaJavadoc.map { it.outputs }) - } -}