diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index 5a5cfe082..fdde671b9 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -27,27 +27,24 @@ subprojects { } } } - // to test local publishing use ./gradlew publish and comment nexusPublishing -// repositories { -// maven { -// def releasesRepoUrl = "$System.env.HOME/repos/releases" -// def snapshotsRepoUrl = "$System.env.HOME/repos/snapshots" -// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl -// } -// } - } - if (project.hasProperty('signing.keyId')) { - signing { - sign publishing.publications.mavenJava - } + // To test local publishing use ./gradlew publish and comment nexusPublishing + // + // repositories { + // maven { + // def releasesRepoUrl = "$System.env.HOME/repos/releases" + // def snapshotsRepoUrl = "$System.env.HOME/repos/snapshots" + // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + // } + // } } - //customize the pom in afterEvaluate to allow subproject build.gradle files to - //contribute the description field + // Customize the pom for all publications and sign all, in afterEvaluate so + // subproject build.gradle files can contribute (e.g. description) and custom + // publications (e.g. shadow) exist. afterEvaluate { subproject -> - subproject.publishing.publications.mavenJava { - pom { + subproject.publishing.publications.withType(MavenPublication).each { publication -> + publication.pom { name = subproject.description description = subproject.description url = 'https://github.com/temporalio/sdk-java' @@ -79,5 +76,12 @@ subprojects { } } } + if (subproject.hasProperty('signing.keyId')) { + subproject.signing { + subproject.publishing.publications.withType(MavenPublication).each { publication -> + sign publication + } + } + } } } diff --git a/temporal-workflowcheck/build.gradle b/temporal-workflowcheck/build.gradle index 18ea959b2..ef6ac097a 100644 --- a/temporal-workflowcheck/build.gradle +++ b/temporal-workflowcheck/build.gradle @@ -33,14 +33,16 @@ startScripts.dependsOn shadowJar // Configure publishing to publish both regular library jar and shadow executable jar publishing { publications { - // Regular library jar for programmatic usage and compile-time annotations - maven(MavenPublication) { - from components.java - } + // Regular library jar for programmatic usage and compile-time annotations. + // That publication is configured by the default setup in publishing.gradle. + // mavenJava(MavenPublication) { ... } + // Fat executable jar with shaded dependencies shadow(MavenPublication) { publication -> project.shadow.component(publication) artifactId = "${project.name}-all" + artifact sourcesJar + artifact javadocJar } } }