Performing release using Maven and Perforce
Since TeamCity 6.0.2, it is much simplier to setup a build configuration which runs release:prepare maven task with Perforce VCS.
This is due to support of "checkout on agent" for Perforce, which was added in TeamCity 6.0
But there are still some issues you should be aware of.
At the very beginning, please make sure that your release:prepare maven task works when it is run from the command line, without TeamCity.
Check that you're using at least 2.0 version of maven release plugin. This to ensure using of non-buggy version of Maven Perforce provider (maven-scm-provider-perforce 1.2+).
The next step is to setup Perforce authentication in TeamCity. Most likely, you don't want to specify P4 password specifically for maven release plugin. So, you should use ticket-based authentication and enable corresponding option ("Use ticket-based authentication") in Perforce of your build configuration in TeamCity. Also, your authentication settings in TeamCity should allow commits to your repository.
For release:prepare task to work, you must use "Automatically on agent" VCS Checkout Mode
Make sure your build agent environment doesn't have any occasional P4* variables, which can spoil execution of maven release plugin. For instance, there can be some invalid P4CONFIG or P4PORT variables.
If your build agent is running in Unix/Mac environment, apply the workaround from the following issue (if it is not fixed in your version of TeamCity)
So this is it. Your maven configuration should work with release:prepare goal.