What is the 'best practice' way of separating Maven deployment configuration from the build config?
I have a war
project, that is built by Jenkins. I'd like Jenkins to deploy this to Elastic Beanstalk, but alas the best solution available at the moment is to use the beanstalk-maven-plugin
.
I'm not sure it makes sense for the POM.xml to include information about deployment; after all, at build time that .war
could end up anywhere.
In this situation, is there some way of using Maven modules to store the beanstalk-maven-plugin
config in a separate POM to that of the actual software project?
I think you have to solutions.
- Just add the
beanstalk-maven-plugin
definition to your regular pom.xml
. The configuration can be stored in separate properties file or provided via system properties in command line (-D
option). Add beanstalk
goal to command line of maven in Jenkins. So, each build will be deployed on beanstalk. Alternatively you can define yet another project in Jenkins that just runs the deployment without compilation. You can run this deployment project on scheduled basis or via projects dependencies in Jankins.
- Create yet another maven project. It will just run beanstalk plugin. I personally do not see serious advantages to do this.
I think about three things:
a. I'm not sure (I'm admit I was a bit busy trying to come up with 0.2.7-RC7), but I think the Elastic Beanstalk Configuration Files are supported in Java.
So it perhaps could be a good idea to separate (I admit managing config in Beanstalker is Boring)
b. Another option is using war overlays in maven-war-plugin's overlay feature, and create a war which depends on your other war.
In my personal case, if you ask, I do have a separate deployment profile in Maven, and that feature often come in handy