diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/maven-publish.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/maven-publish.gradle.kts index fb09e1d98..88b323080 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/maven-publish.gradle.kts @@ -33,6 +33,13 @@ val javadocJarStub by tasks.creating(Jar::class) { archiveClassifier.set("javadoc") } +val sourcesJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + // Accessing sourceSets within the Java plugin's scope + project.plugins.withType().configureEach { + from(project.the().sourceSets["main"].allSource) + } +} publishing { publications.withType().configureEach { @@ -42,6 +49,10 @@ publishing { artifact(javadocJarStub) + // Added 2023-12-02 to fix "Missing: no sources jar found in folder + // '/io/kweb/kweb-core/1.4.9'" encountered when publishing to Maven Central + artifact(sourcesJar) + // apply default configs for all Maven publications pom { name.set("Kweb")