Hi, I have the following question on how to setup a Maven environment in a multi environment (test, staging, production). Ps.this is the first Maven project I'm doing ... having an ANT background.
Lets' start by talking what I have. We have a multi project structure and are using profiles (-Denv=test) which sets all the configuration data during the build lifecycle. Up until now we were just using the 1.0-SNAPSHOTversion for all our modules but a release is coming near and it seems I don't have a clear view on what has to happen now. I've read about the release:prepare / perform plugin but I'm unsure how it should be handled in a multi environment. So here come the questions: 1. What exactly does the release plugin provide on the end, is it a packaged module .war / .jar with the newly set version and stored in the repository? 2. Now we deploy a version to our servers using cargo and specify the profile we want to use, for example -Denv=test when we want to put something in the test environment. What I've seen so far of the release plugin is that you need to specify the profile to which environment you are building. Because the DB url / driver are kept in the maven profiles and are needed to run the tests and to work with in the deployed application. So do we need to release multiple versions? What I mean is do we need to release something like app-test-1.0.war app-staging-1.0.war app-production-1.0.war? I guess so because how else will we get the correct version if we want to deploy on a specific version, if we have just version application-1.0.war we have no idea for which environment it can be used. But .. if so ... I have no idea on how to do this with the release plugin, because you can add a version id like test1.0 or production-1.0 but after the first entry the sources will already be tagged in scm, so what about the others? Or do you provide just one release app-1.0.jar ... which actually makes more sense to me because we release 1 version which needs to work for all environments. But how do we handle this Up until now I've always put my application variables in the profiles (i.e. datasource, connection url, userid passw, email settings ...) but when we only release one version an use that to deploy to ALL environments how will the correct application values be set? 3. Also the same for testing (unit / integration), during the development we test against the test database, we we deploy to staging the build lifecycle rexecutes all these tests again, should these tests be ran against the test database or against the staging database? But what about production do you still run the test against the production database that way, but we still want to run tests.. against which database are we testing this? Test, Dev? I would really like to know what the best practices are on how to build / deploy / release in a multi environment. And feel free to inform me on this topic and not be limited to the questions above ;-) Looking forward to your responses!!! Grtz M.