Maven-分开部署与部署项目 [英] Maven - Separating Deployment & Project

查看:218
本文介绍了Maven-分开部署与部署项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Maven部署配置与构建配置分开的最佳实践"方法是什么?

What is the 'best practice' way of separating Maven deployment configuration from the build config?

我有一个由詹金斯(Jenkins)建立的war项目.我希望Jenkins将其部署到Elastic Beanstalk,但是目前最好的解决方案是使用beanstalk-maven-plugin.

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.

我不确定POM.xml是否包含有关部署的信息是否合理;毕竟,在构建时.war可能会出现在任何地方.

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.

在这种情况下,是否可以使用Maven模块将beanstalk-maven-plugin配置存储在与实际软件项目不同的单独的POM中?

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. 只需将beanstalk-maven-plugin定义添加到常规pom.xml中.该配置可以存储在单独的属性文件中,也可以通过命令行中的系统属性(-D选项)提供.在詹金斯的Maven命令行中添加beanstalk目标.因此,每个构建都将部署在beantalk上.或者,您可以在Jenkins中定义另一个项目,该项目仅运行部署而无需编译.您可以按计划或通过Jankins中的项目依赖项运行此部署项目.
  2. 创建另一个Maven项目.它将仅运行beantalk插件.我个人认为这样做没有明显的优势.
  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.

这篇关于Maven-分开部署与部署项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆