Skip to content

Commit

Permalink
EPNG-7964 - gradle properties were not set properly and could not be …
Browse files Browse the repository at this point in the history
…used used by `com.bmuschko:gradle-nexus-plugin`
  • Loading branch information
Lukas Spalek committed Mar 10, 2021
1 parent 6ab2db9 commit 00e487e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ script: "./gradlew clean build jacocoTestReport coveralls"
before_install:
- openssl aes-256-cbc -K $encrypted_c2f58914b0fd_key -iv $encrypted_c2f58914b0fd_iv -in secret-keys.gpg.enc -out secret-keys.gpg -d
after_success:
- ./gradlew publish -i
- ./gradlew publish -i closeRepository
env:
global:
- CI_NAME=travis-ci
Expand Down
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ scmVersion {

allprojects {
project.version = scmVersion.version

def nexusUsername = project.findProperty("nexusUsername") ?: System.getenv("nexusUsername")
def nexusPassword = project.findProperty("nexusPassword") ?: System.getenv("nexusPassword")
def signingKeyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
def signingPassword = project.findProperty("signing.password") ?: System.getenv("SIGNING_PASSWORD")
def signingSecretKeyRingFile = project.findProperty("signing.secretKeyRingFile") ?: System.getenv("SIGNING_SECRET_KEY_RING_FILE")

println "Key is null: ${signingKeyId == null} "

if (!nexusUsername || !nexusPassword) {
throw new RuntimeException("nexusUsername and/or nexusPassword are not defined environment variables")
}

if (!signingKeyId || !signingPassword || !signingSecretKeyRingFile) {
throw new RuntimeException("signing keyId and/or password and/or secretKeyRingFile are not defined environment variables")
}

project.ext."nexusUsername" = nexusUsername
project.ext."nexusPassword" = nexusPassword
project.ext."signing.keyId" = signingKeyId
project.ext."signing.password" = signingPassword
project.ext."signing.secretKeyRingFile" = signingSecretKeyRingFile
}

nexusStaging {
Expand Down
31 changes: 0 additions & 31 deletions wiremock-spring-boot-starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,6 @@ plugins {
id 'eclipse'
}

task setupVariables << {
def nexusUsername = project.findProperty("nexusUsername") ?: System.getenv("nexusUsername")
def nexusPassword = project.findProperty("nexusPassword") ?: System.getenv("nexusPassword")
def signingKeyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
def signingPassword = project.findProperty("signing.password") ?: System.getenv("SIGNING_PASSWORD")
def signingSecretKeyRingFile = project.findProperty("signing.secretKeyRingFile") ?: System.getenv("SIGNING_SECRET_KEY_RING_FILE")

println "Key is null: ${signingKeyId == null} "

def file = new File(signingSecretKeyRingFile)

print "File exists: ${file.exists()}"

if (!nexusUsername || !nexusPassword) {
throw new RuntimeException("nexusUsername and/or nexusPassword are not defined environment variables")
}

if (!signingKeyId || !signingPassword || !signingSecretKeyRingFile) {
throw new RuntimeException("signing keyId and/or password and/or secretKeyRingFile are not defined environment variables")
}

System.properties.setProperty("nexusUsername", nexusUsername)
System.properties.setProperty("nexusPassword", nexusPassword)
System.properties.setProperty("signing.keyId", signingKeyId)
System.properties.setProperty("signing.password", signingPassword)
System.properties.setProperty("signing.secretKeyRingFile", signingSecretKeyRingFile)
}


uploadArchives.dependsOn('setupVariables')

apply plugin: 'org.springframework.boot'

repositories {
Expand Down
31 changes: 0 additions & 31 deletions wiremock/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,6 @@ tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

task setupVariables << {
def nexusUsername = project.findProperty("nexusUsername") ?: System.getenv("nexusUsername")
def nexusPassword = project.findProperty("nexusPassword") ?: System.getenv("nexusPassword")
def signingKeyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
def signingPassword = project.findProperty("signing.password") ?: System.getenv("SIGNING_PASSWORD")
def signingSecretKeyRingFile = project.findProperty("signing.secretKeyRingFile") ?: System.getenv("SIGNING_SECRET_KEY_RING_FILE")

println "Key is null: ${signingKeyId == null} "

def file = new File(signingSecretKeyRingFile)

print "File exists: ${file.exists()}"

if (!nexusUsername || !nexusPassword) {
throw new RuntimeException("nexusUsername and/or nexusPassword are not defined environment variables")
}

if (!signingKeyId || !signingPassword || !signingSecretKeyRingFile) {
throw new RuntimeException("signing keyId and/or password and/or secretKeyRingFile are not defined environment variables")
}

System.properties.setProperty("nexusUsername", nexusUsername)
System.properties.setProperty("nexusPassword", nexusPassword)
System.properties.setProperty("signing.keyId", signingKeyId)
System.properties.setProperty("signing.password", signingPassword)
System.properties.setProperty("signing.secretKeyRingFile", signingSecretKeyRingFile)
}


uploadArchives.dependsOn('setupVariables')

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down

0 comments on commit 00e487e

Please sign in to comment.