1
votes

After configuring the following docker containers for jhipster, everything's fine except sonar:

  • docker run --name jhipster -w /home/jhipster/app -v ~/jhipster:/home/jhipster/app:rw -v ~/.m2:/home/jhipster/.m2:rw -p 8080:8080 -p 3000:3000 -p 3001:3001 -d -t jdubois/jhipster-docker;
  • docker-compose -f src/main/docker/dev.yml up -d;
  • docker-compose -f src/main/docker/sonar.yml up -d.

mvn builds the app correctly, but mvn sonar:sonar build fails with the error:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project app: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar failed: SonarQube server can not be reached at http://localhost:9000. Please check the parameter 'sonar.host.url'. Connection refused -> [Help 1]

I think that jhipster container cannot reach sonar container because the host is configured to localhost, but I can't find the parameter 'sonar.host.url' to update with the ip 192.168.99.100 of the sonar container. Do I need to configure this ip somewhere? Do I need to configure something else on jhipster container to reach sonar container?

Thanks in advance!

1

1 Answers

2
votes

With the SonarQube Scanner for Maven, sonar properties can be configured in Maven XML settings and in the project's pom.xml (documentation here).

sonar.host.url being not project specific, it's better defined in the global Maven settings.

<properties>
    <sonar.host.url>http://192.168.99.100:port</sonar.host.url>
</properties>