1

Hello Stackoverflow Community,

I have a problem with Jenkins and I just can not solve it.

I have two projects, one is a test project that I built quickly together and here the pom is commited and pushed by the maven release: prepare.

The second project is my main project and here the pom file is not commited and pushed. In addition, the WAR file is not uploaded to the nexus.

I have here first my test project and the Jenkins Logs. Here you can see that the maven-release-plugin in version 2.5.3 is being pulled and used. It is also the pom file commited and pushed.

    [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

Now the Jenkins Logs from my main project. Here you can see that the maven-release-plugin in version 2.3.2 is being used. The mvn dependency: resolve-plugin shows that the version 2.5.3 is used and also the mvn help: effective-pom only shows the version 2.5.3. I did the queries locally and Jenkins runs in the cloud.

    [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

My problem is the jenkins or the mvn release: prepare my pom not commited and my file was not uploaded to the nexus. mvn release:prepare not committing changes to pom.xml

But we get it now that my Jenkins process uses a newer version of the maven-release-plugin to build my project.

I just do not understand why the test project works and my main project fails.

joesworld
  • 21
  • 4
  • If you have differences between your jobs which version of plugins in Maven is used. The simply issue is that you don't have defined the plugin versions in your pom files. which you always should do... – khmarbaise Oct 01 '18 at 07:45
  • My pom and child pom all have a version number 2.5.3. The mvn dependency: resolve-plugin shows that the version 2.5.3 is used and therefore the mvn help: effective-pom only shows the version 2.5.3. – joesworld Oct 01 '18 at 09:09
  • Only my Jenkins Process shows me the maven-release-plugin version 2.3.2 – joesworld Oct 02 '18 at 13:55

1 Answers1

0

I further analyzed my problem and found out the following. The maven release plugin is pulled out of the super pom. This super pom can be found in the plugin maven-model-builder. In my .m2 repository, however, an old maven-model-builder version is pulled and therefore the effective pom also runs an old maven-release-plugin version. The effective pom is mixed together from my poms and the super pom. I pulled the effective pom and looked at mvn dependency: tree or maven dependency: resolve-plugin. In the issues but no maven-model-builder and I can not see why he pulls an old maven-builder version.

It may be that it does not show me the dependencies correctly and that maven here maybe no good resolution makes my plugins.

I have a maven 3.5.4 local and 3.5.4 on the Jenkins too. This should also be a new maven-model-builder version and a new super pom available to get the right maven-release-plugin.

I have already tried the maven model builder in a new version as a plugin in my pom insert, but to no avail.

It must be on my poms to load any old plugin. But maven does not show the correct dependencies with the commands I also do not see a maven-model-builder plugin or dependency in the output.

How can I get it now that maven-model-builder refers to a newer version? How can I further analyze my effective pom, dependencies and plugin to find out which plugin is responsible for the old maven-model-builder plugin?

joesworld
  • 21
  • 4