Skip to content

Commit

Permalink
Add pom-only artifacts for core and library (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
tumbarumba committed Nov 27, 2018
1 parent 212e8c5 commit 6018066
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -116,4 +145,6 @@ publishing {
signing {
required { publishToOssrh }
sign publishing.publications.hamcrest
sign publishing.publications.hamcrestCore
sign publishing.publications.hamcrestLibrary
}

0 comments on commit 6018066

Please sign in to comment.