1

我有两个项目(项目 B 取决于项目 A)我正在尝试设置声纳和詹金斯。我能够在 Jenkins 中成功构建这两个项目。我创建了两个新工作来运行项目 A 和 B 的声纳。

项目 A 的代码比项目 B 少得多,A 构建良好并在我的声纳服务器(与 jenkins 相同的机器)上创建了一个项目。

当我运行项目 B 时,出现异常

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project crush-root: For artifact {junit:junit:null:jar}: The version cannot be empty. -> [Help 1]

我的 POM 没有定义任何关于声纳的东西,比如 Project A。我确实定义了 JUnit

<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version> // 4.10
            <scope>test</scope>
        </dependency>

在我的工件服务器上,sonar-maven-plugin-3.0.1.pom 将 JUnit 4.12 定义为依赖项。JUnit 4.10 和 4.12 都在我的工件中。

每个模块都成功构建,但 maven 摘要显示根 pom 失败,我不想发布整个 pom(> 1000 行,我不知道什么是相关的,因为我没有 sonar-plugin 配置那里)但如果你认为它会有所帮助。

我该如何进一步调试?我应该在 jenkins 上擦除我的 m2 存储库并重试吗?有任何想法吗?

带有异常的 Maven 摘要

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Crush Root ......................................... FAILURE [ 11.489 s]
[INFO] Crush Portal ....................................... SUCCESS [  30.362 s]
....
[INFO] Selenium ........................................... SUCCESS [  1.609 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:17 min
[INFO] Finished at: 2016-04-04T12:57:56-04:00
[INFO] Final Memory: 352M/1026M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project crush-root: For artifact {junit:junit:null:jar}: The version cannot be empty. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project crush-root: For artifact {junit:junit:null:jar}: The version cannot be empty.
    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:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:332)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: For artifact {junit:junit:null:jar}: The version cannot be empty.
    at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
    at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:81)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 30 more
Caused by: org.apache.maven.artifact.InvalidArtifactRTException: For artifact {junit:junit:null:jar}: The version cannot be empty.
    at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:148)
    at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:123)
    at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:695)
    at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:655)
    at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:649)
    at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:607)
    at org.apache.maven.bridge.MavenRepositorySystem.createArtifact(MavenRepositorySystem.java:98)
    at org.apache.maven.project.DefaultProjectBuilder.initProject(DefaultProjectBuilder.java:697)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:174)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:284)
    at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:577)
    at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:190)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:532)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:584)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:584)
    at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:584)
    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:118)
    at org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder.buildDependencyTree(DefaultDependencyTreeBuilder.java:163)
    at org.sonarsource.scanner.maven.DependencyCollector.collectProjectDependencies(DependencyCollector.java:91)
    at org.sonarsource.scanner.maven.DependencyCollector.toJson(DependencyCollector.java:145)
    at org.sonarsource.scanner.maven.bootstrap.MavenProjectConverter.merge(MavenProjectConverter.java:207)
    at org.sonarsource.scanner.maven.bootstrap.MavenProjectConverter.configureModules(MavenProjectConverter.java:175)
    at org.sonarsource.scanner.maven.bootstrap.MavenProjectConverter.configure(MavenProjectConverter.java:125)
    at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.collectProperties(RunnerBootstrapper.java:118)
    at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:78)
    ... 33 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
4

1 回答 1

0

我不知道根本原因,我将我的存储库分解为许多存储库,问题就消失了......

于 2016-04-12T14:51:08.007 回答