SonarCloud - Github Actions Maven Monorepo error

Template for a good new topic, formatted with Markdown:

  • ALM used - GitHub
  • CI system used - Github Actions
  • Languages of the repository - Java (Maven)
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    Error: SonarQube server [http://localhost:9000] can not be reached
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary for Craftory 1.0.0:
    [INFO] Craftory … FAILURE [ 0.330 s]
    [INFO] craftory-api … SUCCESS [ 23.579 s]
    [INFO] craftory-example … SUCCESS [ 0.582 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 35.779 s
    [INFO] Finished at: 2021-02-11T00:02:05Z
    [INFO] ------------------------------------------------------------------------
    Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project craftory-parent: 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 (Connection refused) → [Help 1]
    Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
    Error: Re-run Maven using the -X switch to enable full debug logging.
    Error: For more information about the errors and possible solutions, please read the following articles:
    Error: [Help 1]
    Error: Process completed with exit code 1.
  • Steps to reproduce
    I setup a monrepo with a parent POM and two child projects and followed the SonarCloud steps to get Github actions running as a CI. From the error logs I can see the two projects pass but the parent doesn’t. There are no sonar cloud details in the parent POM as it is just the parent of the other two modules and not meant to have analysis on it yet causing the build to fail.

Is there a way to fix this to stop it erroring?

Hello @brettsaunders21 ,

Welcome to the community!

For me it looks like the setting is missing from the properties in your pom.xml. Please add the following line and check if it works: