Sonar authorization is failing from maven


I am using SonarQube 7.7 version. I am looking for a single maven command to run sonar analysis with java and python.

I am running sonarqube from maven profile. But when I am trying to run my profile from jenkins I see a failure with the message “Please provide the values of the properties sonar.login and sonar.password.”, in my maven profile I just provide the sonar property, Can you please provide me a way to pass the login only without passing the password. So that I can run it from jenkins.

Hi there.

Are you trying to avoid adding sonar.login to the maven profile to not have it in the source code?

Thanks, I passed sonar login property and passed a token. It worked. But Is there any way where I specify the token on Jenkins and from pom.xml I just pass a key which will be replaced at run time. I can’t pass the token from the pom.xml for security reason.

Ok, that’s what I thought.
Generally speaking, you’ll want to configure the login in Jenkins, when configuring the job, and not in the pom file (or anywhere else in the source code).
You can also check out the Scanner for Jenkins:

1 Like