I understood that sonar should not be executed in “unsecure” environments (pull requests).
But via .travis.yml the sonar execution cannot be omitted (and so fails due to missing configuration - localhost:9000).
Here my try
language: java
# https://docs.travis-ci.com/user/sonarcloud/
addons:
sonarcloud:
organization: "quaddy-services-github" # the key of the org you chose at step #3
# see SONAR_TOKEN property in https://travis-ci.org/quaddy-services/escape-from-intranet/settings
# token:
# secure: "*********" # encrypted value of your token
script:
# https://community.sonarsource.com/t/travis-plugin-is-failing-on-external-pull-request/807/8
# https://docs.travis-ci.com/user/pull-requests#double-builds-on-pull-requests
# the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn clean install'
as addon already performed
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar