SonarQubeMojo的SonarQube Intellij插件错误



我在运行intellij SonarQube插件时遇到问题。在连接到我的声纳服务器后,我可以看到不同的项目对我来说是可用的。我现在正试图将其设置为本地分析。

我的本地分析脚本如下

mvn.bat sonar:sonar -Dmaven.compiler.source=1.7 -Dmaven.compiler.target=1.7 -DskipTests=true -Dsonar.language=java -Dsonar.analysis.mode=incremental -Dsonar.host.url=https://www.sonarserver -Dsonar.login=admin -Dsonar.password=●●●●●●●

我得到的错误是,

ERROR 11:59:09.944 > Aug 5, 2016 11:59:09 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
ERROR 11:59:09.945 > WARNING: Error injecting: org.sonarsource.scanner.maven.SonarQubeMojo
ERROR 11:59:09.945 > java.lang.TypeNotPresentException: Type org.sonarsource.scanner.maven.SonarQubeMojo not present
ERROR 11:59:09.945 >    at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:109)
ERROR 11:59:09.945 >    at org.sonatype.guice.bean.reflect.NamedClass.load(NamedClass.java:45)
ERROR 11:59:09.945 >    at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
ERROR 11:59:09.945 >    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
ERROR 11:59:09.945 >    at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
ERROR 11:59:09.945 >    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
ERROR 11:59:09.945 >    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
ERROR 11:59:09.945 >    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
ERROR 11:59:09.945 >    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
ERROR 11:59:09.945 >    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
ERROR 11:59:09.945 >    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
ERROR 11:59:09.945 >    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
ERROR 11:59:09.945 >    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
ERROR 11:59:09.945 >    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
ERROR 11:59:09.945 >    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
ERROR 11:59:09.945 >    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
ERROR 11:59:09.945 >    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
ERROR 11:59:09.945 >    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
ERROR 11:59:09.945 >    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
ERROR 11:59:09.945 >    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
ERROR 11:59:09.945 >    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
ERROR 11:59:09.945 >    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
ERROR 11:59:09.945 >    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
ERROR 11:59:09.945 >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
ERROR 11:59:09.945 >    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
ERROR 11:59:09.945 >    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
ERROR 11:59:09.945 >    at java.lang.reflect.Method.invoke(Method.java:597)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
ERROR 11:59:09.945 > Caused by: java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 51.0
ERROR 11:59:09.945 >    at java.lang.ClassLoader.defineClass1(Native Method)
ERROR 11:59:09.945 >    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
ERROR 11:59:09.945 >    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
ERROR 11:59:09.945 >    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
ERROR 11:59:09.945 >    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
ERROR 11:59:09.945 >    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
ERROR 11:59:09.945 >    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
ERROR 11:59:09.945 >    at java.security.AccessController.doPrivileged(Native Method)
ERROR 11:59:09.945 >    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
ERROR 11:59:09.945 >    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
ERROR 11:59:09.945 >    at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:101)
ERROR 11:59:09.945 >    ... 41 more
INFO 11:59:09.970 > [INFO] ------------------------------------------------------------------------
INFO 11:59:09.970 > [INFO] BUILD FAILURE
INFO 11:59:09.970 > [INFO] ------------------------------------------------------------------------
INFO 11:59:09.972 > [INFO] Total time: 9.480s
INFO 11:59:09.978 > [INFO] Finished at: Fri Aug 05 11:59:09 EDT 2016
INFO 11:59:10.199 > [INFO] Final Memory: 27M/227M
INFO 11:59:10.200 > [INFO] ------------------------------------------------------------------------
INFO 11:59:10.239 > [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project cruw-ui: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 51.0

我已经搜索了类似的问题,它说你需要使用1.7或更高版本进行编译。我已经在脚本中定义了编译器和源目标,所以它应该使用1.7,对吗?我还缺少什么?

所以问题似乎是Maven仍然使用错误的java版本,即使我在命令行中设置了它。我所做的是手动设置JAVA_HOME环境变量,使其指向我的JAVA 1.8 JDK安装路径。这样做之后,sonarqube似乎起了作用。

相关内容

  • 没有找到相关文章

最新更新