问题
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.
回答1:
The Gradle documentation is a great place to start.
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."
回答2:
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/
来源:https://stackoverflow.com/questions/34010168/gradle-dependency-management-with-feature-branch