Skip to content

Commit 6018066

Browse files
authored
Add pom-only artifacts for core and library (hamcrest#235)
1 parent 212e8c5 commit 6018066

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ def pomConfigurationFor(String pomName, String pomDescription) {
8383
}
8484
}
8585

86+
def appendDependency(Object dependencies, String artifactId) {
87+
def dependency = dependencies.appendNode('dependency')
88+
dependency.appendNode('groupId', 'org.hamcrest')
89+
dependency.appendNode('artifactId', artifactId)
90+
dependency.appendNode('version', rootProject.version)
91+
}
92+
8693
def publishToOssrh = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
8794

8895
publishing {
@@ -97,6 +104,28 @@ publishing {
97104
'Hamcrest',
98105
'Core API and libraries of hamcrest matcher framework.')
99106
}
107+
108+
hamcrestCore(MavenPublication) {
109+
artifactId 'hamcrest-core'
110+
pom pomConfigurationFor(
111+
'Hamcrest Core',
112+
'Core Hamcrest API - deprecated, please use "hamcrest" instead')
113+
pom.withXml {
114+
def dependencies = asNode().appendNode('dependencies')
115+
appendDependency(dependencies, 'hamcrest')
116+
}
117+
}
118+
119+
hamcrestLibrary(MavenPublication) {
120+
artifactId 'hamcrest-library'
121+
pom pomConfigurationFor(
122+
'Hamcrest Library',
123+
'A library of Hamcrest matchers - deprecated, please use "hamcrest" instead')
124+
pom.withXml {
125+
def dependencies = asNode().appendNode('dependencies')
126+
appendDependency(dependencies, 'hamcrest-core')
127+
}
128+
}
100129
}
101130
repositories {
102131
if (publishToOssrh) {
@@ -116,4 +145,6 @@ publishing {
116145
signing {
117146
required { publishToOssrh }
118147
sign publishing.publications.hamcrest
148+
sign publishing.publications.hamcrestCore
149+
sign publishing.publications.hamcrestLibrary
119150
}

0 commit comments

Comments
 (0)