0

我无法让模块排除与 Jenkins maven 插件一起使用,请参阅下面的输出:

07:11:53 Executing Maven:  -B -f /home/jenkins/.jenkins/workspace/my_project/pom.xml clean cobertura:cobertura install -P nogpl,ci -pl -gotham/java/dev-server -X -e
07:12:00 Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T17:37:52+00:00)
07:12:04 Maven home: /home/jenkins/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/jenkins_maven
07:12:06 Java version: 1.7.0_60, vendor: Oracle Corporation
07:12:06 Java home: /usr/local/java/jdk1.7.0_60/jre
07:12:06 Default locale: en_US, platform encoding: UTF-8
07:12:06 OS name: "linux", version: "3.5.0-23-generic", arch: "amd64", family: "unix"
07:12:06 [INFO] Error stacktraces are turned on.
07:12:06 [DEBUG] Reading global settings from /home/jenkins/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/jenkins_maven/conf/settings.xml
07:12:06 [DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
07:12:06 [INFO] Scanning for projects...
07:12:06 [ERROR] Could not find the selected project in the reactor: -gotham/java/dev-server -> [Help 1]

当我将命令复制到同一作业中的预构建 shell 步骤中时,它可以工作:

07:20:27 + mvn -B -f /home/jenkins/.jenkins/workspace/my_project/pom.xml clean cobertura:cobertura deploy -P nogpl,ci -pl -gotham/java/dev-server -X -e
07:20:27 Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T17:37:52+00:00)
07:20:27 Maven home: /home/jenkins/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/jenkins_maven
07:20:27 Java version: 1.7.0_60, vendor: Oracle Corporation
07:20:27 Java home: /usr/local/java/jdk1.7.0_60/jre
07:20:27 Default locale: en_US, platform encoding: UTF-8
07:20:27 OS name: "linux", version: "3.5.0-23-generic", arch: "amd64", family: "unix"
07:20:30 [INFO] Error stacktraces are turned on.
07:20:30 [DEBUG] Reading global settings from /home/jenkins/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/jenkins_maven/conf/settings.xml
07:20:30 [DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
07:20:30 [DEBUG] Using local repository at /home/jenkins/.m2/repository
07:20:30 [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /home/jenkins/.m2/repository
07:20:30 [INFO] Scanning for projects...
[...]
07:20:31 [INFO] ------------------------------------------------------------------------
07:20:31 [INFO] Reactor Build Order:

在堆栈跟踪中,您可以看到 hudson-maven 代理正在干扰。显着的区别是:

  • 哈德逊用途org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard和外壳用途...launchEnhanced
  • hudson 失败,org.apache.maven.DefaultMaven.trimSelectedProjects但 shell 失败...trimExcludedProjects

完整的堆栈跟踪是:

    Could not find the selected project in the reactor: -gotham/java/dev-server -> [Help 1]
org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: !gotham/java/dev-server
    at org.apache.maven.DefaultMaven.trimSelectedProjects(DefaultMaven.java:886)
    at org.apache.maven.DefaultMaven.createProjectDependencyGraph(DefaultMaven.java:820)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:268)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    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: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.Maven32Main.launch(Maven32Main.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:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    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)

当我故意尝试在预构建步骤中排除不存在的模块时,将其与故障堆栈跟踪进行比较:

org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: gotham/java/dev-server2
        at org.apache.maven.DefaultMaven.trimExcludedProjects(DefaultMaven.java:977)
        at org.apache.maven.DefaultMaven.createProjectDependencyGraph(DefaultMaven.java:821)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:268)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        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.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

我也尝试过使用语法,也尝试过在like-pl !gotham/java/dev-server之后不加空格pl-pl!gotham/java/dev-server

注意:这些运行之间存在细微差别 - 直接从 shell 执行的是Using local repository at /home/jenkins/.m2/repository,而通过插件执行的不是。我不确定是什么原因,但我怀疑它是否相关

我正在使用 Jenkins 版本 1.540 和 maven-project 插件 v. 2.8(最新)

4

1 回答 1

2

显然这确实不被支持 - https://issues.jenkins-ci.org/browse/JENKINS-26472

于 2015-01-19T11:48:16.267 回答