Skip to content

Commit

Permalink
Use SonarQube system property "sonar.token".
Browse files Browse the repository at this point in the history
  • Loading branch information
smarkwal committed Apr 3, 2024
1 parent 1e5a6d8 commit e811764
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ org.gradle.jvmargs = -Xmx1024m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m
# Sonar token
# alternative: environment variable SONAR_TOKEN
# (see ~/.gradle/gradle.properties)
#sonar.login =
#systemProp.sonar.token =

# signing information
# (see ~/.gradle/gradle.properties)
Expand Down
6 changes: 3 additions & 3 deletions jarhc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ gradle.taskGraph.whenReady {

// if sonar task should be executed ...
if (gradle.taskGraph.hasTask(":sonar")) {
// environment variable SONAR_TOKEN or property "sonar.login" must be set
val tokenFound = project.hasProperty("sonar.login") || System.getenv("SONAR_TOKEN") != null
// environment variable SONAR_TOKEN or system property "sonar.token" must be set
val tokenFound = System.getProperties().containsKey("sonar.token") || System.getenv("SONAR_TOKEN") != null
if (!tokenFound) {
val error = "Sonar: Token not found.\nPlease set property 'sonar.login' or environment variable 'SONAR_TOKEN'."
val error = "Sonar: Token not found.\nPlease set system property 'sonar.token' or environment variable 'SONAR_TOKEN'."
throw GradleException(error)
}
}
Expand Down

0 comments on commit e811764

Please sign in to comment.