Maven analysis doesn't use latest scanner

scanner
maven

(Christine Karman) #1

I am having an issue with scanning a project on a local docker sonarqube instance.

In my pom file I have

    	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.sonarsource.scanner.maven</groupId>
					<artifactId>sonar-maven-plugin</artifactId>
					<version>3.5.0.1254</version>
				</plugin>


The SonarQube version is 7.1 build 11001.

This is in settings.xml

 <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
  ...
 <profile>
    <id>sonar</id>
    <activation>
   <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
  <sonar.host.url>
    http://localhost:9000
  </sonar.host.url>
    </properties>
 </profile>

I run “mvn clean install sonar:sonar” in my project dir. What I get is

    [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project moses-server: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar failed: A required class was missing while executing org.codehaus.mojo:sonar-maven-plugin:2.0:sonar: org/sonatype/aether/graph/DependencyFilter
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/christine/.m2/repository/org/codehaus/mojo/sonar-maven-plugin/2.0/sonar-maven-plugin-2.0.jar
[ERROR] urls[1] = file:/home/christine/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[2] = file:/home/christine/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[3] = file:/home/christine/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[4] = file:/home/christine/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[5] = file:/home/christine/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/home/christine/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[7] = file:/home/christine/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[8] = file:/home/christine/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

It wants to use sonar maven plugin 2.0, I can’t find a reference to version 2.0 in my project. I have spent about a day trying to figure this out. I’m sure I’m doing something wrong, maybe soneone sees what it is?


(Colin Mueller) #2

Christine,

What happens if your run something like the following?

mvn clean install org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar

You should also be able to specify a version in your project’s pom.xml

You might also check to see if your organisation is using a proxy of the central repo and whitelisting certain versions? Just a thought.

Colin


(Christine Karman) #3

Thank you colin for

mvn clean install org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar

You saved my day.