Jenkins/Maven build dying with "Could not find the selected project in the reactor" error
Asked Answered
B

1

6

I’m using Jenkins on the Cloudbees build service and nave a multi-module Maven project. Recently, we removed a project from our parent pom, however, when we run the build in Jenkins with the following options …

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

The artifacts are automatically stored into a Cloudbees snapshot repository attached to our account. However, the build ultimately fails with the below “Could not find the selected project in the reactor: org.mainco.subco:oldmodule” error. Is there a way to force the build to

[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)
Brickle answered 27/2, 2015 at 22:20 Comment(0)
C
0

Take a look at what Maven is executing:

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

In the -pl part is your old module. As you tell maven to use the parent project to build a module that's no longer part of that project, it fails.

Where is that command generated? Is suspect the old module be in one of your maven profiles or the Jenkins configuration.

C answered 14/8, 2018 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.