I have my java code in Github. I am trying to integrate SonarQube with CodeBuild phase. I have included the commands in Buildspec.yml file. But the build is failing with the error
COMMAND_EXECUTION_ERROR: Error while executing command: mvn clean package sonar:sonar -Dsonar.host.url=http://ec2-3-87-142-74.compute-1.amazonaws.com -Dsonar.login=4b10472faeabd02e136783eba7a052c02e0ff79a. Reason: exit status 1
Whereas if im running the same command
mvn sonar:sonar -Dsonar.login=4b10472faeabd02e136783eba7a052c02e0ff79a -Dsonar.host.url=http://ec2-3-87-142-74.compute-1.amazonaws.com Dsonar.login=admin -Dsonar.password=admin
from the command line build is getting succeeded and the report is pushed to SonarQube dashboard.
note: i have gone though Is it possible to integrate Sonarqube with AWS codepipeline/codebuild this thread
Attaching my code along with pom.xml and buildspec file for your reference.
Also let me know if there is a way to integrate Sonarqube with Github for push events also, as i have gone through some docs i got to know that everytime pull request number should be updated in the sonarproperties file present in the repo.