2

我尝试下载并安装声纳,然后使用 Maven 声纳插件运行分析。我已经尝试过第一个 Sonar 版本 2.14,现在又尝试了 2.13.1,但我一遍又一遍地遇到同样的错误。

似乎无法从 localhost(声纳服务器)下载 jdbc 驱动程序,因为我收到此错误消息:“无法下载文件:http://localhost:9000/deploy/jdbc-driver.jar(无代理) : 读取超时 -> [帮助 1]"

但是,如果我用浏览器访问http://localhost:9000/deploy/jdbc-driver.jar,它会毫无问题地下载文件,因此看来声纳服务器工作方式正确,并且 maven 声纳插件做错了我无法弄清楚的事情。

我也尝试将声纳的上下文根更改为 /sonar,但我得到了同样的错误。我已将声纳配置为使用 postgreSQL 而不是嵌入式 Derby 数据库,但仍然没有运气。从浏览器访问声纳就像一个魅力,但我无法运行 mvn sonar:sonar 所以此时我的声纳安装非常没用...... :(

这是使用 -e 选项运行 maven 的堆栈跟踪:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project betterfarmer-engine: Can not execute Sonar: Fail to download the
file: http://localhost:9000/deploy/jdbc-driver.jar (no proxy): Read timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project betterfarmer-engi
ne: Can not execute Sonar
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        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:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.sonar.api.utils.SonarException: Fail to download the file: http://localhost:9000/deploy/jdbc-driver.jar (no proxy)
        at org.sonar.api.utils.HttpDownloader.download(HttpDownloader.java:130)
        at org.sonar.batch.bootstrap.ArtifactDownloader.downloadJdbcDriver(ArtifactDownloader.java:58)
        at org.sonar.batch.bootstrap.JdbcDriverHolder.<init>(JdbcDriverHolder.java:43)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:147)
        at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:319)
        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:274)
        at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:341)
        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:689)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:638)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:663)
        at org.sonar.api.platform.ComponentContainer.getComponentByType(ComponentContainer.java:113)
        at org.sonar.batch.bootstrap.Module.getComponentByType(Module.java:131)
        at org.sonar.batch.bootstrap.BootstrapModule.configure(BootstrapModule.java:63)
        at org.sonar.batch.bootstrap.Module.init(Module.java:49)
        at org.sonar.batch.bootstrap.Module.init(Module.java:41)
        at org.sonar.batch.Batch.<init>(Batch.java:37)
        at org.sonar.maven3.SonarMojo.executeBatch(SonarMojo.java:143)
        at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:136)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
        ... 23 more
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at sun.net.www.MeteredStream.read(MeteredStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2959)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2953)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1262)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236)
        at org.sonar.api.utils.HttpDownloader.download(HttpDownloader.java:125)
        ... 48 more
[ERROR]
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
4

1 回答 1

0

您的声纳可能未正确安装。

我建议从全新安装开始(在与前一个文件夹不同的文件夹中),并在启动新的 Sonar 之前检查您是否没有指向先前安装位置的 env 属性。

于 2012-04-12T06:42:15.950 回答