声纳传感器Maven依赖

时间:2013-10-11 15:07:33

标签: maven sonarqube

我正在尝试在不使用内部分析器(CPD,SQUID ......)的情况下将一些测量部署到Sonar 3.5中,但是在Maven依赖性分析中我得到了nullpointer异常:

INFO] [08:23:01.789] Sensor Maven dependencies...
[DEBUG] Dependency tree resolution listener events:
[DEBUG] testArtifact: artifact=fr.tus.mvn-test:test-app:nar:2.0-SNAPSHOT
[DEBUG] includeArtifact: artifact=fr.tus.mvn-test:test-app:nar:2.0-SNAPSHOT
[DEBUG] startProcessChildren: artifact=fr.tus.mvn-test:test-app:nar:2.0-SNAPSHOT
[DEBUG] [08:23:01.797] Release semaphore on project : org.sonar.api.resources.Project@68dc2d[id=158,key=fr.tus:mvn-test,qualifier=TRK], with key batch-fr.tus:mvn-test
[DEBUG] [08:23:01.814] To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
[DEBUG] [08:23:01.819] Delete temporary directory: /tmp/sonar-batch59250110776125096297764152719386
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] mvn-test Project .................................. FAILURE [6.679s]
[INFO] mvn-library Project ............................... SKIPPED
[INFO] mvn-app Project ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.481s
[INFO] Finished at: Sat Sep 21 08:23:01 PDT 2013
[INFO] Final Memory: 13M/182M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:3.5:sonar (default-cli) on project mvn-test: Execution default-cli of goal org.codehaus.sonar:sonar-maven-plugin:3.5:sonar failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:3.5:sonar (default-cli) on project mvn-test: Execution default-cli of goal org.codehaus.sonar:sonar-maven-plugin:3.5:sonar failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.sonar:sonar-maven-plugin:3.5:sonar failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.NullPointerException
    at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:579)
    at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:192)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:532)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:144)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:100)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:782)
    at org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder.buildDependencyTree(DefaultDependencyTreeBuilder.java:97)
    at org.sonar.plugins.design.batch.MavenDependenciesSensor.analyse(MavenDependenciesSensor.java:73)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
    at org.sonar.batch.phases.Phases.execute(Phases.java:101)
    at org.sonar.batch.scan.ScanContainer.doStart(ScanContainer.java:147)
    at org.sonar.batch.bootstrap.Container.start(Container.java:72)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:65)
    at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:56)
    at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:54)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:49)
    at org.sonar.batch.bootstrap.TaskContainer.doStart(TaskContainer.java:188)
    at org.sonar.batch.bootstrap.Container.start(Container.java:72)
    at org.sonar.batch.bootstrap.TaskBootstrapContainer.executeTask(TaskBootstrapContainer.java:73)
    at org.sonar.batch.bootstrap.TaskBootstrapContainer.doStart(TaskBootstrapContainer.java:62)
    at org.sonar.batch.bootstrap.Container.start(Container.java:72)
    at org.sonar.batch.bootstrap.BootstrapContainer.doStart(BootstrapContainer.java:104)
    at org.sonar.batch.bootstrap.Container.start(Container.java:72)
    at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:88)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:72)
    at org.sonar.maven.SonarMojo.execute(SonarMojo.java:150)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 20 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/PluginExecutionException

当我运行mvn dependency:tree时,依赖树正确显示。

感谢您的帮助。

纳迪尔阿。

1 个答案:

答案 0 :(得分:0)

当您使用Maven编译C / C ++插件时,SonarQube正在尝试分析POM中指定的依赖关系。看起来其中一个被重新定位但Maven无法设法检索它 - 但我无法告诉你如何解决这个问题。

您可以使用SonarQube Runner运行SonarQube分析 - 它不会尝试运行MavenDependenciesSensor类。我很确定这会解决你的问题。