Skip to content

Commit 473430d

Browse files
committed
Handle missing gradle.properties
1 parent d6cbea5 commit 473430d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ apply plugin: 'signing'
66
group 'com.widen.oss'
77
archivesBaseName = 'tabitha'
88
version '0.1.0-SNAPSHOT'
9+
910
sourceCompatibility = 1.8
11+
targetCompatibility = 1.8
12+
13+
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
14+
ext.username = hasProperty("ossrhUsername") ? ossrhUsername : System.getenv("OSSRH_USERNAME")
15+
ext.password = hasProperty("ossrhPassword") ? ossrhPassword : System.getenv("OSSRH_PASSWORD")
16+
1017

1118
repositories {
1219
mavenCentral()
@@ -25,6 +32,7 @@ dependencies {
2532
testCompile 'cglib:cglib-nodep:3.2.5'
2633
}
2734

35+
2836
task javadocJar(type: Jar) {
2937
classifier = 'javadoc'
3038
from javadoc
@@ -43,6 +51,9 @@ artifacts {
4351

4452
signing {
4553
sign configurations.archives
54+
required {
55+
isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives")
56+
}
4657
}
4758

4859
uploadArchives {
@@ -51,11 +62,11 @@ uploadArchives {
5162
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
5263

5364
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
54-
authentication(userName: ossrhUsername, password: ossrhPassword)
65+
authentication(userName: username, password: password)
5566
}
5667

5768
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
58-
authentication(userName: ossrhUsername, password: ossrhPassword)
69+
authentication(userName: username, password: password)
5970
}
6071

6172
pom.project {

0 commit comments

Comments
 (0)