Maven - Separating Deployment & Project

倖福魔咒の 提交于 2019-12-08 01:35:59

问题


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?


回答1:


I think you have to solutions.

  1. 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.
  2. Create yet another maven project. It will just run beanstalk plugin. I personally do not see serious advantages to do this.



回答2:


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



来源:https://stackoverflow.com/questions/12298046/maven-separating-deployment-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!