SonarQube server [http://localhost:9001] can not be reached

I have following step of setting up my repositories on sonar cloud using the given steps for ’ I have a pipeline’
I added the plugin
plugins {
id “org.sonarqube” version “4.4.1.3373”
}

and then updated my pipeline script with

clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly

/gradlew --stacktrace bootJar sonar -Dsonar.gradle.skipCompile

But I get error

Task :sonar FAILED
SonarQube server [http://localhost:9001] can not be reached

Caused by: java.net.ConnectException: Connection refused

at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:130)

at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:263)

I even tried following config in my build.gradle

sonar {
properties {
property “sonar.projectKey”, “<project_name>”
property “sonar.organization”, “<organization_name>”
property “sonar.host.url”, “https://sonarcloud.io
}
}

Hi,

You’ve omitted the sonar.host.url. [The docs](https://the Reference branch new code definition is not supported) should help.

 
Ann