We have multiple repositories in Nexus (i.e., releases, snapshot and site). All 3 repos are under public group and users uses the same credentials to access all these repositori
It looks like you mistaken things here. The given credentials and id's are for the distributionManagement and not for the access to the Nexus in this case. Apart from that you need three different username, password combinations cause you have three possible things releases, snapshots and site. So not a big deal.
Aprt from that i would suggest to upgrade Maven into Maven 3.X line cause Maven 2.2.1 is a little bit out of date.
Not a solution but a workaround:
settings.xml will handle system properties and environment variables. So if you're not fussed about putting your server authentication details in a script or in your environment, you can stick with three server credentials but eliminate the need to update all three of them in favour of updating your script or environments (I've put examples for both options in this snippet):
<servers>
<server>
<id>releases</id>
<username>${env.NEXUS_USERNAME}</username> <!-- Env var -->
<password>${nexus.password}</password> <!-- System (-D) var -->
</server>
<server>
<id>snapshots</id>
<username>${env.NEXUS_USERNAME}</username> <!-- Env var -->
<password>${nexus.password}</password> <!-- System (-D) var -->
</server>
<server>
<id>site</id>
<username>${env.NEXUS_USERNAME}</username> <!-- Env var -->
<password>${nexus.password}</password> <!-- System (-D) var -->
</server>
</servers>
Unfortunately there's no <properties>
element supported in settings.xml!
Aside: maven already handles the snapshots and releases repositories within nexus, and that is the better way to do things. Your posted settings.xml even enables them already. Why do you need separate repository entries for snapshots and releases?
Just use one entry in setttings.xml like that
<server>
<id>nexus</id>
<username>deployment</username>
<password>deployment123</password>
</server>
and then in distributionManagement in your pom.xml's you use something like that
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Nexus Snapshot</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
For fully working setup with this look at the Nexus Book Examples project that are used in the trial guide. You can add a site with the same id as well, of course. Keep in mind that there is no problem if the id;s are the same as they just detail the identifier of the server element in settings to look for and are NOT an id element for the repository. Imho it should be called serverId or something to be clearer, but thats a different story.