jenkins maven不会推送我的pom,而是使用旧的maven-release-prepare版本

时间:2018-10-01 07:03:28

标签: git maven jenkins

Hello Stackoverflow社区,

我对詹金斯(Jenkins)有问题,但我解决不了。

我有两个项目,一个是我快速构建在一起的测试项目,而pom是由Maven版本提交和推送的:准备。

第二个项目是我的主项目,这里pom文件未提交和推送。 此外,WAR文件不会上载到链接。

我首先在这里拥有我的测试项目和Jenkins Logs。 在这里您可以看到2.5.3版中的maven-release-plugin已被拉出并使用。这也是提交和推送的pom文件。

    [Moss-Jenkins-Test-Release] $ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/M3/bin/mvn -f pom.xml -s /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/.conf/settings.xml -D-Duser.timezone="CET" release:prepare
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building moss-jenkins-test Maven Webapp 6.0.13-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5.3:prepare (default-cli) @ moss-jenkins-test ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git rev-parse --show-toplevel
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git status --porcelain .
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "moss-jenkins-test Maven Webapp"? (jenkins-test:moss-jenkins-test) 6.0.13: : What is SCM release tag or label for "moss-jenkins-test Maven Webapp"? (m1ss-jenkins-test:moss-jenkins-test) moss-jenkins-test-6.0.13: : What is the new development version for "moss-jenkins-test Maven Webapp"? (m1ss-jenkins-test:moss-jenkins-test) 6.0.14-SNAPSHOT: : [INFO] Transforming 'moss-jenkins-test Maven Webapp'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO] 
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building moss-jenkins-test Maven Webapp 6.0.13
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] 
[INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ moss-jenkins-test ---
[INFO] [INFO] 
[INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ moss-jenkins-test ---
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/src/main/resources
[INFO] [INFO] 
[INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ moss-jenkins-test ---
[INFO] [INFO] Changes detected - recompiling the module!
[INFO] [INFO] Compiling 1 source file to /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/target/classes
[INFO] [INFO] 
[INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ moss-jenkins-test ---
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/src/test/resources
[INFO] [INFO] 
[INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ moss-jenkins-test ---
[INFO] [INFO] Changes detected - recompiling the module!
[INFO] [INFO] Compiling 1 source file to /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/target/test-classes
[INFO] [INFO] 
[INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ moss-jenkins-test ---
[INFO] [INFO] Surefire report directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/target/surefire-reports
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running mossjenkinstest.TestMain
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec
[INFO] 
[INFO] Results :
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] [INFO] 
[INFO] [INFO] --- maven-war-plugin:2.2:war (default-war) @ moss-jenkins-test ---
[INFO] [INFO] Packaging webapp
[INFO] [INFO] Assembling webapp [moss-jenkins-test] in [/var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/target/moss-jenkins-test]
[INFO] [INFO] Processing war project
[INFO] [INFO] Copying webapp resources [/var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/src/main/webapp]
[INFO] [INFO] Webapp assembled in [390 msecs]
[INFO] [INFO] Building war: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release/target/moss-jenkins-test.war
[INFO] [INFO] WEB-INF/web.xml already added, skipping
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 3.841 s
[INFO] [INFO] Finished at: 2018-09-27T10:55:58Z
[INFO] [INFO] Final Memory: 23M/36M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git add -- pom.xml
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git rev-parse --show-toplevel
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git status --porcelain .
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git commit --verbose -F /tmp/maven-scm-2032289853.commit pom.xml
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Tagging release with the label moss-jenkins-test-6.0.13...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git tag -F /tmp/maven-scm-1945355948.commit moss-jenkins-test-6.0.13
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git ls-files
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Transforming 'moss-jenkins-test Maven Webapp'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git add -- pom.xml
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git rev-parse --show-toplevel
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git status --porcelain .
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release && git commit --verbose -F /tmp/maven-scm-1316586055.commit pom.xml
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Jenkins-Test-Release
[INFO] Release preparation complete.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.865 s
[INFO] Finished at: 2018-09-27T10:55:58Z
[INFO] Final Memory: 10M/19M
[INFO] ------------------------------------------------------------------------
Parsing POMs

现在我主要项目中的詹金斯日志。 在这里您可以看到正在使用2.3.2版中的maven-release-plugin。 mvn依赖项:resolve-plugin显示使用版本2.5.3,并且mvn help:Effective-pom仅显示版本2.5.3。 我在本地进行查询,Jenkins在云中运行。

    [INFO] Building ROOT 9.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ ROOT ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git status
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release
[INFO] Checking dependencies and plugins for snapshots ...

...

 [INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git add -- pom.xml
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git status
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release
[INFO] Tagging release with the label ROOT-9.0.1...
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git tag -F /tmp/maven-scm-121026806.commit ROOT-9.0.1
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git push url ROOT-9.0.1
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release
[INFO] Executing: /bin/sh -c cd /var/lib/jenkins/workspace/Moss-Test-Release && git ls-files
[INFO] Working directory: /var/lib/jenkins/workspace/Moss-Test-Release

我的问题是jenkins或mvn版本:准备未提交我的pom,并且我的文件未上传到网络。 mvn release:prepare not committing changes to pom.xml

但是我们现在知道了,因为我的Jenkins进程使用了​​较新版本的maven-release-plugin来构建我的项目。

我只是不明白测试项目为何起作用而我的主项目失败了。

1 个答案:

答案 0 :(得分:0)

我进一步分析了我的问题,并发现了以下问题。 Maven发行插件已从超级Pom中拉出。 这个超级pom可以在插件maven-model-builder中找到。 但是,在我的.m2存储库中,拉出了旧的maven-model-builder版本,因此有效的pom也运行了旧的maven-release-plugin版本。有效pom从我的pom和超级pom混合在一起。我拉了有效的pom,然后看了mvn依赖关系:tree还是maven依赖关系:resolve-plugin。在问题中,但没有maven-model-builder,我看不到他为什么选择了旧的maven-builder版本。

可能无法正确显示依赖项,并且这里的行家可能没有很好的解决方案来制作我的插件。

我在Jenkins上也有本地3.5.4和3.5.4的maven。 这也应该是新的maven-model-builder版本和可用的新超级pom,以获取正确的maven-release-plugin。

我已经尝试过将新版本的Maven模型构建器作为pom插件中的插件,但无济于事。

加载任何旧插件必须在我的poms上。 但是maven不能使用命令显示正确的依赖关系 我也没有在输出中看到maven-model-builder插件或依赖项。

既然maven-model-builder引用了较新的版本,我如何得到它? 如何进一步分析有效的pom,依赖关系和插件,以找出哪个插件负责旧的maven-model-builder插件?