Sounds like a profile or a classifier situation
Typically, the Maven release process involves tagging the source code that was used to build the artifact. For example, let's say you are building a WAR artifact. The release process essentially does the following:
- Verifies that the current build does not depend on any SNAPSHOT builds (since they could change at any moment and affect production code)
- Updates the pom.xml to provide a version number that represents the release (e.g. 0.0.1-SNAPSHOT becomes 0.0.1)
- Checks the updated pom.xml into version control and tags all source with the release version number (e.g. cvs/tags/0.0.1)
- Deploys the built artifact into the release repository so that teams can share it
In Subversion, this approach is fully supported through the normal tagging process. I can't comment on Git, I'm afraid.
And for our situation with special environments?
Typically, Maven encourages the use of a single released artifact that does not change as it moves through different environments (think external configuration through property files and/or JNDI). If a problem is found within a released artifact it is pushed back to the developers (who are now working on 0.0.2-SNAPSHOT) and 0.0.1 is effectively canned. The developers try again with 0.0.2 and so on. There are variations obviously, but that's a common approach.
If your artifacts need to be different for each environment then Maven can build a different artifact based on either a profile setting (very customisable) or a classifier. From the Maven documentation:
The classifier allows to distinguish
artifacts that were built from the
same POM but differ in their content.
It is some optional and arbitrary
string that - if present - is appended
to the artifact name just after the
version number. As a motivation for
this element, consider for example a
project that offers an artifact
targeting JRE 1.5 but at the same time
also an artifact that still supports
JRE 1.4. The first artifact could be
equipped with the classifier jdk15 and
the second one with jdk14 such that
clients can choose which one to use.
Another common use case for
classifiers is the need to attach
secondary artifacts to the project's
main artifact. If you browse the Maven
central repository, you will notice
that the classifiers sources and
javadoc are used to deploy the project
source code and API docs along with
the packaged class files.