选择基于git分支的maven配置文件 [英] select maven profile based on git branch

查看:361
本文介绍了选择基于git分支的maven配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以根据当前的git分支选择一个配置文件?

例如,如果您在master分支中,它会选择'production '个人资料。如果develop分支,它选择 '发展' 的轮廓。



我发现 mavanagaiata 插件,它提供了 mvngit.branch 属性,但它不能在<使用;简档> 部分。



是这样的可能吗?或者有更好的方法吗?我想要一个简单的方法根据正在构建的分支自动选择正确的配置文件。

解决方案

通过文件激活配置文件。然后在相应的分支中创建文件,这样当你切换分支时文件会出现或消失,这会影响配置文件激活。

然而,我觉得选择基于git分支的maven配置文件是个不错的主意。


Is it possible to select a profile based on what the current git branch is?

For example, if you are in the master branch, it selects the 'production' profile. If it is the develop branch, it selects the 'development' profile.

I found the mavanagaiata plugin which provides the mvngit.branch property but it can not be used in the <profiles> section.

Is something like this possible? Or are there better ways? I want an easy way to automatically select the correct profile depending on the branch being build.

解决方案

Make the profile activation by a file. Then create the file in a corresponding branch only, so that when you switch branches the file will appear or disappear, it will affect the profile activation.

However, I feel that it is bad idea to select maven profile based on git branch.

这篇关于选择基于git分支的maven配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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