Skip to content

Commit 120f46c

Browse files
committed
Fix OSSRH publication check
1 parent 9110d00 commit 120f46c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ def pomConfigurationFor(String pomName, String pomDescription) {
8080
}
8181
}
8282

83+
def publishToOssrh = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
84+
8385
publishing {
8486
publications {
8587
def hamcrestProject = project(':hamcrest')
86-
hamcrestCore(MavenPublication) {
88+
hamcrest(MavenPublication) {
8789
from hamcrestProject.components.java
8890
artifactId hamcrestProject.name
8991
artifact hamcrestProject.sourcesJar
@@ -94,7 +96,7 @@ publishing {
9496
}
9597
}
9698
repositories {
97-
if (hasProperty('ossrhUsername') && hasProperty('ossrhPassword')) {
99+
if (publishToOssrh) {
98100
maven {
99101
def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
100102
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
@@ -109,6 +111,6 @@ publishing {
109111
}
110112

111113
signing {
112-
required { hasProperty('ossrhUsername') && hasProperty('ossrhPassword') }
113-
sign publishing.publications.hamcrestCore
114+
required { publishToOssrh }
115+
sign publishing.publications.hamcrest
114116
}

0 commit comments

Comments
 (0)