具有功能分支的Gradle依赖关系管理 [英] Gradle dependency management with feature branch

查看:92
本文介绍了具有功能分支的Gradle依赖关系管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主要的gradle项目。我有一些由我开发的核心和通用库(也称为gradle项目),它们托管在同一个git服务器(但不同的回购站)上。现在,这些核心和通用库都是我主项目的依赖项。我想将这些依赖添加到我的gradle构建文件中,以便安装正确版本的核心库和通用库(即检出,构建和安装)。我正在使用单词签出,因为我不想总是使用核心和公共库的主分支,而是可能为我的主项目的特定功能分支,核心和公共库的特定分支兼容。我有PHP的经验,并且我知道作曲家是实现相同自动化(定义别名)的非常好的工具。我对这个Gradle世界相当陌生,在这个特定的Gradle用例中我找不到一些相关的材料。
任何指向正确方向的指针都会得到高度赞赏。

解决方案

在Gradle中,我们指定了与GAV的依赖关系(group:神器:版本)。在版本之后,可以将任何单词指定为限定词。这可以是您添加的功能的名称。



有关Maven工件命名约定的更多信息(也用于Gradle中): http://kylelieber.com/2012/06/maven-versioning-strategy/


I have a main gradle project. I have some core and common libraries developed by me (also as gradle projects) which are hosted on the same git server (but different repos). Now these core and common libraries are the dependencies of my main project. I want to add these dependencies in my gradle build file so that the right version of core and common libraries are installed (i.e. checked-out, build and installed). I am using the word check-out because I dont want always the master branch of core and common library to be use, rather it could be that for a particular feature branch of my main project, a specific branch of core and common library is compatible. I have got experience with PHP and I know that composer is a very good tool to achieve the same automation (defining the alias). I am quite new to the gradle world, and I couldn't find some relevant material on this particular use case of gradle. Any pointer in the right direction would be highly appreciated.

解决方案

In Gradle we specify dependence with GAV (group:artifact:version). After version it's possible to specify any word as qualifier. This can be a name of feature, which you've added.

More on Maven artifact naming convention (used also in Gradle): http://kylelieber.com/2012/06/maven-versioning-strategy/

这篇关于具有功能分支的Gradle依赖关系管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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