My Jenkins build is failing with this below error.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:50.002s
[INFO] Finished at: Mon Feb 15 03:59:51 CST 2016
[INFO] Final Memory: 76M/405M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project com.fico.om.dam.assembly: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar: java.lang.NoSuchMethodError: org.sonar.batch.bootstrapper.Batch$Builder.setBootstrapProperties(Ljava/util/Map;)Lorg/sonar/batch/bootstrapper/Batch$Builder;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:3.0.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
[ERROR] urls[1] = file:/root/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/root/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/root/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = file:/root/.m2/repository/org/sonarsource/sonar-runner/sonar-runner-api/2.5.1/sonar-runner-api-2.5.1.jar
[ERROR] urls[8] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/root/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] urls[10] = file:/root/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
I tried clearing the ".m2", even this didn't work. Could you please help. Java jdk: 1.7.0_15 , Maven: 3.0.5. Do let me know if you need more details.
snippet of pom.xml `
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.config.location>../../../COMMON/Source/com.masked/om_checks.xml</checkstyle.config.location>
<checkstyle.outputFile>target/checkstyle/checkstyle-result.xml</checkstyle.outputFile>
<findbug.XMLOutputDirectory>target/findbugs</findbug.XMLOutputDirectory>
<!-- Sonar -->
<sonar.language>java</sonar.language>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${project.basedir}/../com.masked/target/jacoco.exec</sonar.jacoco.reportPath>
<buildNumber>SNAPSHOT</buildNumber>
<dotExecutable>C:/Program Files (x86)/Graphviz2.38/bin/dot.exe</dotExecutable>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<xmlOutput>true</xmlOutput>
<xmlOutputDirectory>${findbug.XMLOutputDirectory}</xmlOutputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jacoco</groupId>
<artifactId>
jacoco-maven-plugin
</artifactId>
<versionRange>
[0.6.3.201306030806,)
</versionRange>
<goals>
<goal>prepare-agent</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<versionRange>
[2.5.1,)
</versionRange>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
<versionRange>
[2.6,)
</versionRange>
<goals>
<goal>resources</goal>
<goal>testResources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.3,)
</versionRange>
<goals>
<goal>copy</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<aggregate>true</aggregate>
<quiet>true</quiet>
</configuration>
<reportSets>
<reportSet>
<id>aggregate</id>
<configuration>
</configuration>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>${checkstyle.configLocation}</configLocation>
<outputFile>${checkstyle.outputFile}</outputFile>
<excludes>${checkstyle.excludes}</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<repositories>
<repository>
<id>XYZRelease</id>
<name>FDO Release</name>
<url>http://pkrappcmf400:8081/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>xqj</id>
<name>XQJ Maven Repository</name>
<url>http://xqj.net/maven</url>
</repository>
<repository>
<id>basex</id>
<name>BaseX Maven Repository</name>
<url>http://files.basex.org/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>XYZRelease</id>
<name>FDO Release</name>
<url>http://pkrappcmf400:8081/nexus/content/repositories/releases</url>
</pluginRepository>
</pluginRepositories>
`
Solution to your Question
When you error with like this
your Maven Repository (Nexus)is not constructed properly (i.e) not having appropriate dependencies JAR files.
Plexus compiler dependencies will require these below list of JAR's (which is mentioned in Log Files) as a dependencies, if you miss any single JAR you will get this kind of Exception. And this has nothing to do with your Maven Version.
Please refer my Log files (Replaced with your Repository) and Ensure these Plexus related JAR files gets downloaded in your Local Maven Repository.