I’ve been working on getting a CI pipeline working using the SonarScanner plugin for Maven, and the most difficult part has been waiting for the entire analysis to finish before finding that it failed with a cryptic message: /bin/bash: line 109: -Dsonar.host.url=https://www.sonar-url.com: No such file or directory
It took hours to figure out, but it turned out some of the variables weren’t expanded correctly, a detail that wasn’t obvious in the pipeline output or the error message. Not only that, but the plugin’s output said “BUILD SUCCESS” at the end, followed by the one-line error message, and returning with a non-zero exit code.
I’d like to suggest the following features to make this a little easier for future users:
- Fix the “BUILD SUCCESS” message when the credentials are invalid
- Output an error message with a clear reason for the failure
- Test the credentials early in the process so the user doesn’t wait for the analysis to complete before finding that it failed.