在CI/Hudson支持下为多个环境[prod,test,dev]生成工件的Maven最佳实践? [英] Maven best practice for generating artifacts for multiple environments [prod, test, dev] with CI/Hudson support?

查看:71
本文介绍了在CI/Hudson支持下为多个环境[prod,test,dev]生成工件的Maven最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要部署到多个环境中的项目(产品,测试,开发).主要区别主要在于配置属性/文件.

I have a project that need to be deployed into multiple environments (prod, test, dev). The main differences mainly consist in configuration properties/files.

我的想法是使用配置文件和覆盖图来复制/配置专用输出.但是如果要使用专用分类器(例如:"my-app-1.0-prod.zip/jar","my-app-1.0-dev.zip/jar")生成多个工件,我就会陷入困境,还是我应该创建多个项目,为每个环境创建一个项目?!
我应该使用maven-assembly-plugin为每个环境生成多个工件吗? 无论如何,我将需要一次生成所有这些文件,以至于它似乎表明配置文件不合适...仍然感到困惑:(

My idea was to use profiles and overlays to copy/configure the specialized output. But I'm stuck into if I have to generate multiple artifacts with specialized classifiers (ex: "my-app-1.0-prod.zip/jar", "my-app-1.0-dev.zip/jar") or should I create multiple projects, one project for every environment ?!
Should I use maven-assembly-plugin to generate multiple artifacts for every environment ? Anyway, I'll need to generate all them at once so it seams that the profiles does not fit ... still puzzled :(

任何提示/示例/链接都将受到欢迎.

Any hints/examples/links will be more than welcomed.

作为附带问题,我还想知道如何在CI Hudson/Bamboo中实现此目的,以针对所有环境生成并部署这些生成的工件,并将其部署到适当的服务器上(例如:使用SCP Hudson插件)?

As a side issue, I'm also wondering how to achieve this in a CI Hudson/Bamboo to generate and deploy these generated artifacts for all the environments, to their proper servers (ex: using SCP Hudson plugin) ?

推荐答案

我更喜欢将配置文件与应用程序分开打包.这使您可以运行完全相同的应用程序,并在运行时提供配置.它还允许您在构建时不知道您需要的环境之后,生成配置文件.例如CERT 我使用汇编"工具将每个域的配置文件压缩为命名文件.

I prefer to package configuration files separately from the application. This allows you to run the EXACT same application and supply the configuration at run time. It also allows you to generate configuration files after the fact for an environment you didn't know you would need at build time. e.g. CERT I use the "assembly" tool to zip up each domain's config files into named files.

这篇关于在CI/Hudson支持下为多个环境[prod,test,dev]生成工件的Maven最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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