无法执行目标org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar(default-cli)

时间:2016-04-06 07:08:37

标签: maven sonarqube sonarqube-scan

我安装了Sonar PMD插件,之后我收到以下错误:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project bpm-parent:
  Execution default goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar failed:
  An API incompatibility was encountered while executing org.sonarscanner.maven:sonar-maven-plugin:3.0.1:sonar:
  java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.classpath()Ljava/llection;
-----------------------------------------------------
realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/yogas/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
urls[1] = file:/C:/Users/yogas/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
urls[2] = file:/C:/Users/yogas/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.ja
urls[3] = file:/C:/Users/yogas/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
urls[4] = file:/C:/Users/yogas/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
urls[5] = file:/C:/Users/yogas/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[6] = file:/C:/Users/yogas/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
urls[7] = file:/C:/Users/yogas/.m2/repository/org/sonarsource/sonar-runner/sonar-runner-api/2.5.1/sonar-runner-api-2.5.1.jar
urls[8] = file:/C:/Users/yogas/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
urls[9] = file:/C:/Users/yogas/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
urls[10] = file:/C:/Users/yogas/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
Number of foreign imports: 1
  import: Entry[import  from realm ClassRealm[maven.api, parent: null]]             

1 个答案:

答案 0 :(得分:2)

这看起来非常简单:

  

遇到API不兼容......

通常,您应该检查Plugin Version Matrix以确保您要安装的插件版本与您的服务器版本兼容。

特别是在这种情况下,它似乎是PMD插件版本与Java插件版本之间的不兼容性(感谢Julien!)。尝试确保安装了最新版本。