詹金斯为不同的环境建设 [英] Jenkins building for different environments

查看:110
本文介绍了詹金斯为不同的环境建设的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在开发框上安装了Jenkins实例。这样构建很好并部署到我们的开发环境中没有任何问题。

I currently have a Jenkins instance installed on a Development box. This builds fine and deploys to our development environment without any issues.

在构建过程中,我的项目使用包含数据库连接URL等详细信息的单个属性文件(这些细节显然会根据我指向的环境而有所不同。)

During the build process my project makes use of a single properties file containing details such as a database connection URL (Details such as these will obviously vary depending on the environment I'm pointing to).

我想知道的是配置项目的最佳方法是什么当我想发布到Production时,Jenkins构建的WAR文件包含Production属性而不是Development?

What I would like to know is what is the best way to configure my project so that when I want to release to Production the WAR file built by Jenkins contains the Production properties instead of Development?

(注意我在项目中也使用了Maven)。 / p>

(Note I am also using Maven in my project).

推荐答案

您可以创建不同的maven配置文件,例如 dev prod ,然后在配置文件设置中,使用/过滤相应的资源文件,如 ... /(dev | test | prod)/project.properties 在Jenkins中,当你为不同的平台构建时,使用 -Pdev或-Pprod 构建以获得正确目标的战争。

You can create different maven profiles, like dev, prod, then in the profile setting, use/filter the corresponding resource files like .../(dev|test|prod)/project.properties And in Jenkins, when you build for different platform, build with -Pdev or -Pprod to get the war for the right target.

您可能需要检查maven配置文件,maven资源过滤以获取详细配置。

You may want to check maven profile, maven resource filtering for detailed configuration.

不相关的内容,如果可能,通过jndi连接数据库。

something not related, connect Database via jndi if possible.

这篇关于詹金斯为不同的环境建设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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