Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-release-plugin prepare vs perform

I am looking to set up release jobs in Jenkins. We use Jenkins, Maven 3 and Perforce for source control and Nexus for repository management.

I have set up jobs with maven goals release:prepare and release:perform, however I notice that build times are doubled as both compilation and testing happens twice. My current understanding of the maven-release-plugin prepare and perform goals are as follows:

maven-release-plugin prepare:

  1. Ensures no local modifications to files in workspace
  2. Edits POMs to set release version
  3. Executes preparationGoals which default to clean verify to ensure code can be compiled and passes tests.
  4. Commits the modified POMs
  5. Creates a VCS Tag
  6. Increments versions of POMs to next development version and commits these POMs to VCS

Also, a release.properties file is created with VCS tag and release and development version information

maven-release-plugin perform

  1. Checks out a fresh copy of source code using the VCS tag from the release.properties to the default location of target/checkout
  2. executes goals of deploy / deploy-site depending on whether the project has a distributionManagement

So in order to stop doubling the build time as well as preserve build integrity, I am thinking of doing the following:

  1. Make jenkins checkout a fresh copy of the latest source code from source repository
  2. Configure the preparationsGoals config element of the release plugin to clean deploy
  3. Just run release:prepare

With the above, I think I can merge the two (prepare and perform) into one step and save on build turn around time. We generally always build with one build environment to target one stack (Java 6, etc) and so as long as the code successfully compiles and passes tests in the preparation step, then it is fine to deploy the artifacts to Nexus.

I am mainly looking for opposing thoughts where the above can go wrong so that I can be saved from what my eyes are blind to.

Thanks

like image 309
user1638152 Avatar asked Nov 12 '22 22:11

user1638152


1 Answers

This is a maven question not a Jenkins one.

In maven the prepare and perform operations do 2 different things. One operate on snapshots, the other in the tagged version of your release. One is deployed to your snapshotRepository the other to your release repository. One creates your next snapshot build, one creates your current release.

They serve different purposes. And both may be failing in their own ways depending on your maven & repository configs. Hence the need to run them both.

like image 152
coffeebreaks Avatar answered Dec 09 '22 10:12

coffeebreaks