Jenkins/Maven 构建因“无法在反应器中找到所选项目”错误而垂死

问题描述 投票:0回答:1

我在 Cloudbees 构建服务上使用 Jenkins 并创建了一个多模块 Maven 项目。最近,我们从父 pom 中删除了一个项目,但是,当我们使用以下选项在 Jenkins 中运行构建时……

clean install -e -P qa -P cloudbees -DskipITs

工件会自动存储到附加到我们帐户的 Cloudbees 快照存储库中。然而,构建最终失败并出现以下“无法在反应器中找到所选项目:org.mainco.subco:oldmodule”错误。有没有办法强制构建

[subco] $ mvn initialize -N
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building subco 76.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.841s
[INFO] Finished at: Fri Feb 27 21:59:22 UTC 2015
[INFO] Final Memory: 5M/115M
[INFO] ------------------------------------------------------------------------
Parsing POMs
Modules changed, recalculating dependency graph
maven31-agent.jar already up to date
maven31-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[subco] $ /opt/jdk/jdk1.7.0/bin/java -Dmaven.test.failure.ignore=false -cp /scratch/jenkins/maven31-agent.jar:/opt/maven/apache-maven-3.1.1/boot/plexus-classworlds-2.5.1.jar:/opt/maven/apache-maven-3.1.1/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven/apache-    maven-3.1.1 /scratch/jenkins/slave.jar /scratch/jenkins/maven31-interceptor.jar /scratch/jenkins/maven3-interceptor-commons.jar 52053
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:moduleA:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-antrun-plugin @ line 508, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:newmodule:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:aspectj-maven-plugin is missing. @ line 200, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[ERROR] Could not find the selected project in the reactor: org.mainco.subco:oldmodule -> [Help 1]
org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: org.mainco.subco:oldmodule
    at org.apache.maven.DefaultMaven.trimSelectedProjects(DefaultMaven.java:750)
    at org.apache.maven.DefaultMaven.createDependencyGraph(DefaultMaven.java:704)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:287)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
    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:606)
    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.Maven31Main.launch(Maven31Main.java:181)
    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:606)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:324)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
maven jenkins cloudbees multi-module reactor
1个回答
0
投票

看看Maven在执行什么:

Executing Maven:  -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs

在 -pl 部分是你的旧模块。当您告诉 Maven 使用父项目构建不再属于该项目的模块时,它会失败。

该命令是在哪里生成的?怀疑旧模块在您的 Maven 配置文件或 Jenkins 配置之一中。

© www.soinside.com 2019 - 2024. All rights reserved.