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:
- Ensures no local modifications to files in workspace
- Edits POMs to set release version
- Executes preparationGoals which default to
clean verifyto ensure code can be compiled and passes tests. - Commits the modified POMs
- Creates a VCS Tag
- 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
- Checks out a fresh copy of source code using the VCS tag from the release.properties to the default location of target/checkout
- executes goals of
deploy/deploy-sitedepending 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:
- Make jenkins checkout a fresh copy of the latest source code from source repository
- Configure the preparationsGoals config element of the release plugin to
clean deploy - 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