Why it looks for [http://localhost:9000]

I’m trying to configure my Maven project for SonarCloud use in GitHub actions.
I have such errors when building on GitHub actions:
Error: SonarQube server [http://localhost:9000] can not be reached

Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project goods-partner: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:9000: Connection refused → [Help 1]

What could bed the reason of failure? why does it looks for http://localhost:9000 though I configured https://sonarcloud.io (see below)?

Here is sonar-cloud.yml:

name: Build
      - 76-sonarcloud-integration
    types: [opened, synchronize, reopened]
    name: Build
    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: Set up JDK 17
        uses: actions/setup-java@v1
          java-version: 17
      - name: Cache SonarCloud packages
        uses: actions/cache@v1
          path: ~/.sonar/cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Cache Maven packages
        uses: actions/cache@v1
          path: ~/.m2
          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
          restore-keys: ${{ runner.os }}-m2
      - name: Build and analyze
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

And here is pom.xml piece:


Are you sure you’ve set the configuration in your root pom.xml, and not one of the subprojects?

Hi Colin!
Yo`re right. Now this moved to parent pom.xml:


But another error occurs:

Please check if these other posts can resolve your issue. You are most likely encountering a problem with how you are defining Sonar analysis parameters of your multimodule project (as defined by the cleanAllWorkingDirs method calls):

This helped to solve my StackOverFlowError:

So I added <sonar.moduleKey>${project.artifactId}</sonar.moduleKey> to the root POM
Thank`s a lot for help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.