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

时间:2016-04-25 19:43:56

标签: java maven sonarqube eclipse-mars sonarlint-eclipse

大家好,这是我在StackOverflow上的第一个问题,希望有人能帮到我解决这个问题: 我试图在Eclipse(Mars 8.2)上配置我的java项目以进行SonarQube检测,但是当我运行配置时输出通知我这个错误:

    [INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:07 min
[INFO] Finished at: 2016-04-26T01:13:06+02:00
[INFO] Final Memory: 45M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project cg4: Unable to load component class org.sonar.batch.report.ActiveRulesPublisher: Unable to load component interface org.sonar.api.batch.rule.ActiveRules: Server is not available: http://localhost:9000/: Fail to request http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-89394&p=1&ps=500: timeout: Read timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project cg4: Unable to load component class org.sonar.batch.report.ActiveRulesPublisher
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to load component class org.sonar.batch.report.ActiveRulesPublisher
    at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:81)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.batch.report.ActiveRulesPublisher
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:621)
    at org.picocontainer.parameters.CollectionComponentParameter.getArrayInstance(CollectionComponentParameter.java:334)
    at org.picocontainer.parameters.CollectionComponentParameter.access$100(CollectionComponentParameter.java:49)
    at org.picocontainer.parameters.CollectionComponentParameter$1.resolveInstance(CollectionComponentParameter.java:139)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:141)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
    at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
    at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
    at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)
    at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
    at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
    at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
    at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy23.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:240)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78)
    ... 23 more
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.ActiveRules
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
    at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
    at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
    at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
    at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
    at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
    ... 59 more
Caused by: java.lang.IllegalStateException: Server is not available: http://localhost:9000/
    at org.sonar.batch.cache.WSLoader.loadFromServerFirst(WSLoader.java:197)
    at org.sonar.batch.cache.WSLoader.load(WSLoader.java:148)
    at org.sonar.batch.cache.WSLoader.loadStream(WSLoader.java:124)
    at org.sonar.batch.rule.DefaultActiveRulesLoader.load(DefaultActiveRulesLoader.java:61)
    at org.sonar.batch.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:104)
    at org.sonar.batch.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:65)
    at org.sonar.batch.rule.ActiveRulesProvider.provide(ActiveRulesProvider.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
    at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
    at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
    at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
    at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
    at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
    ... 73 more
Caused by: java.lang.IllegalStateException: Fail to request http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-89394&p=1&ps=500
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:201)
    at org.sonarqube.ws.client.HttpConnector.get(HttpConnector.java:143)
    at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:132)
    at org.sonar.batch.bootstrap.BatchWsClient.call(BatchWsClient.java:65)
    at org.sonar.batch.cache.WSLoader$3.load(WSLoader.java:85)
    at org.sonar.batch.cache.WSLoader$3.load(WSLoader.java:81)
    at org.sonar.batch.cache.WSLoader.loadFromServer(WSLoader.java:225)
    at org.sonar.batch.cache.WSLoader.loadFromServerFirst(WSLoader.java:188)
    ... 94 more
Caused by: java.net.SocketTimeoutException: timeout
    at okio.Okio$3.newTimeoutException(Okio.java:207)
    at okio.AsyncTimeout.exit(AsyncTimeout.java:261)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:215)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:79)
    at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:909)
    at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:93)
    at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:894)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:748)
    at com.squareup.okhttp.Call.getResponse(Call.java:277)
    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234)
    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:196)
    at com.squareup.okhttp.Call.execute(Call.java:79)
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:198)
    ... 101 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at okio.Okio$2.read(Okio.java:139)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
    ... 115 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我已经阅读了错误通知后提到的链接,但我找不到问题的解决方案,有人可以帮助我吗?

1 个答案:

答案 0 :(得分:2)

问题仅仅是由于服务器的不稳定性;我没有将Sonar置于“运行模式”,所以当“运行配置”试图连接到服务器时,这是离线的,不可再加。 所以在你安装Sonarqube的所有内容之前,你必须(Windows指令)进入名为“sonarqube x.y version”的文件夹,然后执行位于其中的文件.bat进入管理模式。