UdayRaju
UdayRaju

Reputation: 11

sonar-maven-plugin 3.7.0.1746

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:

  1. SonarQube version: 7.9.1
  2. MULE_EE with version 4.2.2
  3. JDK: 1.8.0_251 (mixed mode)
  4. Maven Version : 3.173.0

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

Answers (1)

Eduardo Souza
Eduardo Souza

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

Related Questions