This setup is not documented yet, so these services may change it at anytime
The main trick here is to use the
sonarqube Travis add-on that will set up the proper environment variables the key one being
SONARQUBE_SCANNER_PARAMS that will contain the token and the host URL so you do not have to explicitly put in
$SONAR_TOKEN in the `script` section. In addition, if the add-on detects that it is a pull request it will set the parameters used for SonarQube GitHub Plugin.
This is triggered by having two secure environment variables defined in your build containing your tokens:
SONAR_GITHUB_TOKEN and the token put directly into the `addon: sonarqube: token:`.
Then all you would need is to execute
mvn sonar:sonar in your script to get everything working.