声纳在第一次成功运行后仍然失败

时间:2012-02-23 15:31:56

标签: java sonarqube

第一次运行正常,然后我意识到它缺少一些规则。所以我解决了所有问题并添加了新规则然后重新运行声纳。从那时起声纳将不起作用,它只会一直失败。

每次它给我这个错误:

org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.

我使用的命令是:

mvn clean install -Psonar sonar:sonar

知道可能导致这种情况的原因吗?

org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.
        at org.codehaus.plexus.archiver.AbstractUnArchiver.validate(AbstractUnArchiver.java:185)
        at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:118)
        at org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:258)
        at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.unpackArtifact(UnpackMojo.java:116)
        at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.execute(UnpackMojo.java:94)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
        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.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:85)
        at org.sonar.maven3.Maven3PluginExecutor.concreteExecute(Maven3PluginExecutor.java:49)
        at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:49)
        at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:38)
        at org.sonar.batch.phases.InitializersExecutor.executeMavenPlugin(InitializersExecutor.java:73)
        at org.sonar.batch.phases.InitializersExecutor.execute(InitializersExecutor.java:60)
        at org.sonar.batch.phases.Phases.execute(Phases.java:90)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:111)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:106)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:106)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:101)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:102)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.Batch.execute(Batch.java:100)
        at org.sonar.maven3.SonarMojo.executeBatch(SonarMojo.java:146)
        at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:136)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
        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)
        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:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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)

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:04.569s
[INFO] Finished at: Thu Feb 23 11:19:25 EST 2012
[INFO] Final Memory: 89M/705M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "sonar" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.3:unpack (unpack-pinkcommon-tools) on project pinkcommon-ejb: Error unpacking file: C:\cygwin\home\GIT\trunk\pinkcommo
n\pinkcommon-tools\target\classes to: C:\cygwin\home\GIT\trunk\pinkcommon\pinkcommon-ejb\target\classes
[ERROR] org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.
[ERROR] -> [Help 1]
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project webapps: Can not execute Sonar: Unable to execute maven plugin: Exception during execution of org
.codehaus.mojo:cobertura-maven-plugin:2.5.1:cobertura -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

3 个答案:

答案 0 :(得分:1)

你的问题不在于声纳。我想如果你只是运行'install',你也会遇到同样的问题。

您正在使用依赖项插件,但可能配置错误。这是maven输出中有趣的部分:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.3:unpack (unpack-pinkcommon-tools) on project pinkcommon-ejb: Error unpacking file: C:\cygwin\home\GIT\trunk\pinkcommo
n\pinkcommon-tools\target\classes to: C:\cygwin\home\GIT\trunk\pinkcommon\pinkcommon-ejb\target\classes
[ERROR] org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.

没有你的pom.xml配置,没有更多的人可以帮助你。

答案 1 :(得分:1)

根据http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven,您需要将Sonar设置添加到Maven settings.xml文件中。

您应该编辑位于$ MAVEN_HOME / conf或〜/ .m2中的settings.xml文件,以及要使用的数据库参数以及Sonar服务器URL。

<settings>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- EXAMPLE FOR MYSQL -->
                <sonar.jdbc.url>
                  jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
                </sonar.jdbc.url>
                <sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName>
                <sonar.jdbc.username>sonar</sonar.jdbc.username>
                <sonar.jdbc.password>sonar</sonar.jdbc.password>

                <!-- optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                  http://myserver:9000
                </sonar.host.url>
            </properties>
        </profile>
     </profiles>
</settings>

答案 2 :(得分:1)

问题在于Sonar的Cobertura覆盖插件。这是一个有5年历史的maven-dependency-plugin错误,如果使用解包目标,Cobertura会给出上述错误。请参阅以下Jira门票:

在我的情况下,我找到了使用unpack-dependencies目标的解决方法,而不是在maven-dependency-plugin中解压缩。