The Maven Release plugin enforces best practices for releasing Maven artifacts. In summary, the release plugin performs the following steps:
- Validate no local changes against your SCM
- Validate that there are no SNAPSHOT dependencies
- Convert the modules to the to-be released version
- Ensure the build and Unit/Integration tests succeed
- Commit the changes to SCM, then Tag the release
- Checkout the tag to a clean location and build/deploy the artifacts
Dealing with failures on Step #2 is where I want to focus today.
I answer this question often enough that I decided to burn it to a blog so I don’t have to dig it out of the source anymore…and maybe save someone else the time along the way.
Here is the relevant code that Maven uses to determine if an artifact is a snapshot or not: