Reputation: 11
I am getting below error while using the plugin (sonar-maven-plugin 3.7.0.1746):
ERROR: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project kcc-xbu-saprfc-services-sys-api: Unexpected internal error near index 1
I have added below in pom.xml file in respective sections:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
</plugin>
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
</dependency>
<repository>
<id>org.sonarsource.scanner.maven</id>
<name>sonar-maven-plugin</name>
<url>https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin</url>
<layout>default</layout>
</repository>
<pluginRepository>
<id>org.sonarsource.scanner.maven</id>
<name>sonar-maven-plugin</name>
<layout>default</layout>
<url>https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
Versions currently being used:
However maven is getting executed from "C:\Program Files\Maven\apache-maven-3.6.2\bin\mvn.cmd". I am executing the build using azure pipeline.
Please let me know how to resolve this issue. Thank you.
Upvotes: 1
Views: 3432
Reputation: 41
If you are going to submit your code for SonarQube platform, normally the pom file doesn't need to have those dependencies, instead of it you can decouple that in changing the settings.xml of the maven (if you have a dedicated server, it should be inside .m2 folder for Windows).
Maven's settings.xml should have this profile:
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
<properties>
<sonar.login>*your-user-here*</sonar.login>
<sonar.password>*your-pwd-here*</sonar.password>
<sonar.host.url>*url-of-your-sonar-platform*</sonar.host.url>
</properties>
</activation>
<profile>
After that, you can setup you pipeline to run the following command for your project:
mvn sonar:sonar
Good luck!
Upvotes: 1