简体   繁体   English

具有功能分支的Gradle依赖项管理

[英]Gradle dependency management with feature branch

I have a main gradle project. 我有一个主要的gradle项目。 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). 我有一些由我开发的核心和通用库(也作为gradle项目),它们托管在同一git服务器(但存储库不同)上。 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 (ie checked-out, build and installed). 我想在我的gradle构建文件中添加这些依赖项,以便安装正确版本的核心库和公共库(即检出,构建和安装)。 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). 我有使用PHP的经验,我知道composer是实现相同自动化(定义别名)的一个非常好的工具。 I am quite new to the gradle world, and I couldn't find some relevant material on this particular use case of gradle. 我对gradle世界还很陌生,在这个gradle的特殊用例中我找不到任何相关的材料。 Any pointer in the right direction would be highly appreciated. 任何朝着正确方向的指针将受到高度赞赏。

The Gradle documentation is a great place to start. Gradle文档是一个很好的起点。

Gradle 2.9 - External Dependencies : "There are various types of dependencies that you can declare. One such type is an external dependency. This a dependency on some files built outside the current build, and stored in a repository of some kind, such as Maven central, or a corporate Maven or Ivy repository, or a directory in the local file system." Gradle 2.9-外部依赖项 :“您可以声明各种类型的依赖项。一种类型是外部依赖项。这是对当前构建之外构建的某些文件的依赖关系,并存储在某种类型的存储库中,例如Maven中央,公司的Maven或Ivy存储库或本地文件系统中的目录。”

In Gradle we specify dependence with GAV (group:artifact:version). 在Gradle中,我们使用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/ 有关Maven工件命名约定的更多信息(也在Gradle中使用): http : //kylelieber.com/2012/06/maven-versioning-strategy/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM