From 67204596b974a4163a64c53fe01d9ab9be9addea Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Tue, 30 Aug 2022 15:18:04 +1000 Subject: [PATCH] chore: fix publishing Gradle plugin to Maven Central #1588 --- provider/gradle/build.gradle | 54 ++++++++++++++++++++++++++++++++++++ releasePrep.groovy | 5 ++-- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/provider/gradle/build.gradle b/provider/gradle/build.gradle index 03f304f3d5..c831e657ad 100644 --- a/provider/gradle/build.gradle +++ b/provider/gradle/build.gradle @@ -45,3 +45,57 @@ compileGroovy { dependsOn compileKotlin classpath = classpath.plus(files(compileKotlin.destinationDir)) } + +publishing { + publications { + pluginMaven(MavenPublication) { +// from components.java + + pom { + name = project.name + description = 'Gradle Pact plugin' + url = 'https://github.com/pact-foundation/pact-jvm' + licenses { + license { + name = 'Apache 2' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } + } + scm { + url = 'https://github.com/pact-foundation/pact-jvm' + connection = 'https://github.com/pact-foundation/pact-jvm.git' + } + + developers { + developer { + id = 'thetrav' + name = 'Travis Dixon' + email = 'the.trav@gmail.com' + } + developer { + id = 'rholshausen' + name = 'Ronald Holshausen' + email = 'rholshausen@dius.com.au' + } + } + } + } + } + repositories { + maven { + url "https://oss.sonatype.org/service/local/staging/deploy/maven2" + if (project.hasProperty('sonatypeUsername')) { + credentials { + username sonatypeUsername + password sonatypePassword + } + } + } + } +} + +signing { + required { project.hasProperty('isRelease') } + sign publishing.publications.pluginMaven +} diff --git a/releasePrep.groovy b/releasePrep.groovy index dee789829a..9de6ea98de 100755 --- a/releasePrep.groovy +++ b/releasePrep.groovy @@ -113,11 +113,12 @@ ask('Tag and Push commits?: [Y]') { } ask('Publish artifacts to maven central?: [Y]') { - executeOnShell './gradlew clean publish -S -x :pact-publish:publish -PisRelease=true' + executeOnShell './gradlew clean publish -S -x :pact-publish:publish -x :provider:gradle:publish -PisRelease=true' + executeOnShell './gradlew :provider:gradle:publishPluginMavenPublicationToMavenRepository -PisRelease=true' } ask('Publish Gradle plugin?: [Y]') { - executeOnShell './gradlew :provider:gradle:publishPlugins -S -PisGradleRelease=true' + executeOnShell './gradlew :provider:gradle:publishPlugins -PisRelease=true' } ask('Publish pacts to pact-foundation.pactflow.io?: [Y]') {