From 6018066a722bb6592d98fbe4e043ca78ce528000 Mon Sep 17 00:00:00 2001 From: Joe Schmetzer Date: Tue, 27 Nov 2018 16:41:46 +0000 Subject: [PATCH] Add pom-only artifacts for core and library (#235) --- build.gradle | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/build.gradle b/build.gradle index fa054a28..9d455541 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,13 @@ def pomConfigurationFor(String pomName, String pomDescription) { } } +def appendDependency(Object dependencies, String artifactId) { + def dependency = dependencies.appendNode('dependency') + dependency.appendNode('groupId', 'org.hamcrest') + dependency.appendNode('artifactId', artifactId) + dependency.appendNode('version', rootProject.version) +} + def publishToOssrh = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword') publishing { @@ -97,6 +104,28 @@ publishing { 'Hamcrest', 'Core API and libraries of hamcrest matcher framework.') } + + hamcrestCore(MavenPublication) { + artifactId 'hamcrest-core' + pom pomConfigurationFor( + 'Hamcrest Core', + 'Core Hamcrest API - deprecated, please use "hamcrest" instead') + pom.withXml { + def dependencies = asNode().appendNode('dependencies') + appendDependency(dependencies, 'hamcrest') + } + } + + hamcrestLibrary(MavenPublication) { + artifactId 'hamcrest-library' + pom pomConfigurationFor( + 'Hamcrest Library', + 'A library of Hamcrest matchers - deprecated, please use "hamcrest" instead') + pom.withXml { + def dependencies = asNode().appendNode('dependencies') + appendDependency(dependencies, 'hamcrest-core') + } + } } repositories { if (publishToOssrh) { @@ -116,4 +145,6 @@ publishing { signing { required { publishToOssrh } sign publishing.publications.hamcrest + sign publishing.publications.hamcrestCore + sign publishing.publications.hamcrestLibrary }