I am having a problem with the Maven release process. I have created the compile phase of my process in such a way that you can compile the same version or a higher version, but you compiling a pervious version will error. (This is required as objects are being pushed into the database during the compile stage and I don't want these to regress to previous versions.)

I have a project and in the pom file it is specified that it is version 0.0.1-SNAPSHOT

I run maven release:prepare, using all the default settings and it works fine giving me a new pom file with the version 0.0.2-SNAPSHOT

I then run maven release:perform, and at this stage it hits an issue. 
It seems that it compiles version 0.0.1-SNAPSHOT after it has already compiled version 0.0.1. Since 0.0.1-SNAPSHOT comes before 0.0.1 I get an error.

My question is why is the release plugin compiling 0.0.1-SNAPSHOT after it has already compiled 0.0.1. Also at this time the pom.xml has version 0.0.2-SNAPSHOT.

Can anyone explain/point to documentation showing this process and if possible tell me how I can prevent this behavour.