プロジェクトでsonarQubeを実行すると、以下の例外が発生します。プロジェクトでsonarQubeを実行しようとすると、以下のunsupportedClassVersion例外が発生します
D:\Repos\testPA\testPA>mvn sonar:sonar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testPA 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.0.1:sonar (default-cli) @ testPA ---
[WARNING] Error injecting: org.sonarsource.scanner.maven.SonarQubeMojo
Java.lang.TypeNotPresentException: Type org.sonarsource.scanner.maven.SonarQubeM
ojo not present
at org.Eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.Java:115
)
at org.Eclipse.sisu.space.NamedClass.load(NamedClass.Java:46)
at org.Eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClas
s.Java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(Provider
InternalFactory.Java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.prov
ision(InternalFactoryToInitializableAdapter.Java:54)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInt
ernalFactory.Java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.Java:113)
at org.Eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanSchedul
er.Java:176)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.Java:122)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
rovisionListenerStackCallback.Java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
erInternalFactory.Java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
InternalFactoryToInitializableAdapter.Java:46)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.Java:10
09)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
va:1059)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.Java:1005)
at com.google.inject.Scopes$1$1.get(Scopes.Java:59)
at org.Eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.Java:82)
at org.Eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.Java:5
1)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.Java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.Java:255)
at org.Apache.maven.plugin.internal.DefaultMavenPluginManager.getConfigu
redMojo(DefaultMavenPluginManager.Java:464)
at org.Apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.Java:119)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.Java:208)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.Java:153)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.Java:145)
at org.Apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.Java:116)
at org.Apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.Java:80)
at org.Apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.Java:51)
at org.Apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.Java:120)
at org.Apache.maven.DefaultMaven.doExecute(DefaultMaven.Java:355)
at org.Apache.maven.DefaultMaven.execute(DefaultMaven.Java:155)
at org.Apache.maven.cli.MavenCli.execute(MavenCli.Java:584)
at org.Apache.maven.cli.MavenCli.doMain(MavenCli.Java:216)
at org.Apache.maven.cli.MavenCli.main(MavenCli.Java:160)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
Java:39)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.Java:25)
at Java.lang.reflect.Method.invoke(Method.Java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.Java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.Java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.Java:
356)
Caused by: Java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/maven
/SonarQubeMojo : Unsupported major.minor version 51.0
at Java.lang.ClassLoader.defineClass1(Native Method)
at Java.lang.ClassLoader.defineClass(ClassLoader.Java:620)
at Java.security.SecureClassLoader.defineClass(SecureClassLoader.Java:12
4)
at Java.net.URLClassLoader.defineClass(URLClassLoader.Java:260)
at Java.net.URLClassLoader.access$000(URLClassLoader.Java:56)
at Java.net.URLClassLoader$1.run(URLClassLoader.Java:195)
at Java.security.AccessController.doPrivileged(Native Method)
at Java.net.URLClassLoader.findClass(URLClassLoader.Java:188)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(Cl
assRealm.Java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
SelfFirstStrategy.Java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
ass(ClassRealm.Java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.Java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.Java:239)
at org.Eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.Java:107
)
... 41 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.454 s
[INFO] Finished at: 2016-02-23T16:17:46+05:30
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:
3.0.1:sonar (default-cli) on project testPA: Execution default-cli of goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar failed: Unable to
load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-p
lugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.component.reposi
tory.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQube
Mojo : Unsupported major.minor version 51.0
[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:/C:/Users/vb/.m2/repository/org/sonarsource/sca
nner/maven/sonar-maven-plugin/3.0.1/sonar-maven-plugin-3.0.1.jar
[ERROR] urls[1] = file:/C:/Users/vb/.m2/repository/org/Apache/maven/sh
ared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/C:/Users/vb/.m2/repository/org/codehaus/plexus
/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/C:/Users/vb/.m2/repository/org/Eclipse/aether/
aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/C:/Users/vb/.m2/repository/org/sonatype/plexus
/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/C:/Users/vb/.m2/repository/org/sonatype/plexus
/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/C:/Users/vb/.m2/repository/org/codehaus/plexus
/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = file:/C:/Users/vb/.m2/repository/org/sonarsource/son
ar-runner/sonar-runner-api/2.5.1/sonar-runner-api-2.5.1.jar
[ERROR] urls[8] = file:/C:/Users/vb/.m2/repository/commons-lang/common
s-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/C:/Users/vb/.m2/repository/com/google/guava/gu
ava/18.0/guava-18.0.jar
[ERROR] urls[10] = file:/C:/Users/vb/.m2/repository/com/google/code/fi
ndbugs/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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.Apache.org/confluence/display/MAVEN/PluginContaine
rException
Sonarqube 5.3をインストールしました。コマンドプロンプトからソナーを実行しようとすると、上記の例外が発生します。 http:// localhost:90 を介してsonarQubeを起動でき、sonarqubeのUIを細かく表示できます。
Sonar-runner-api 2.8では、JDK 8が必要なようです。
はい、JDK 7以降が必要です( 修正方法:サポートされていないmajor.minorバージョン51.0エラーを参照してください )。
JDK 6以前でもプロジェクトをビルドできますが、SonarQube分析はJDK 7以降で実行する必要があります。