It's straightforward with Maven in the Java world
mvn clean deploy
In our configuration, this does all the necessary building of the WAR file (pulling in the JAR dependencies as needed), the deployment to the dev web server and creation of canned test data on the dev database. Once that's in place Maven handles the comprehensive functional testing through SeleniumRC to verify the application works.
This single command gets the application fully deployed to the dev server cluster so it's readily available for other developers to immediately work with (assuming it passed the tests). It's unusual for a dev deployment to fail since developers have verified it works locally with mvn clean install
.
The snapshot artifact (WAR) is then copied into the Maven repository for sharing with other developers (as per the standard Maven deploy
behaviour).
OK, but you've only deployed a snapshot to dev, what about test and production?
The distribution to the test and (later) production servers is handled through the Maven release process which we like to handle manually to ensure that someone is watching for any suspicious output. Testers only work with released artifacts, not snapshots.
Once it's released then a simple build script is used to SFTP the WAR file to the test server cluster, again with someone watching the process to ensure nothing goes wrong.
Finally, after all the testers are happy the unchanged WAR file is SFTP'd up to the failover production server cluster, with someone keeping a close eye and an immediate rollback position in place in case of disaster.