Mvn sonar:sonar cannot login

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project PDEngine: Not authorized. Please check the properties sonar.login and sonar.password. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
developer@e995b10dc8e5:/build$ cat ~/.m2/settings.xml 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<settings>
	<pluginGroups>
		<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
	</pluginGroups>
	<profiles>
		<profile>
			<id>sonar</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<sonar.host.url>https://sonarcloud.io</sonar.host.url>
				<sonar.login>magwas</sonar.login>
				<sonar.password>(token generated at https://sonarcloud.io/account/security/)</sonar.password>
			</properties>
		</profile>
	</profiles>
</settings>

for sonar.login I have tried both ‘magwas’ and ‘magwas@github’

This was working before…

Your configuration is incorrect. If you use token then you have to set:

<sonar.login>token</sonar.login>

and don’t add the password. It is described in the documentation User Token.

2 Likes