I want to use master version of my lib from mavencentral.
Is it possible to declare git repository as dependency in android gradle?
I want to use master version of my lib from mavencentral.
Is it possible to declare git repository as dependency in android gradle?
For me the best way is:
https://jitpack.io
Step 1. Add the JitPack repository to your build file Add it in your build.gradle at the end of repositories:
Step 2. Add the dependency in the form
It is possible to build the latest commit on the master branch, for example :
dependencies { compile 'com.github.jitpack:gradle-simple:master-SNAPSHOT' }
Or you can register a repository as a submodule like this
Then include the project in your settings.gradle file which should look like this
Finally, compile the project as a dependency in your application build.gradle file like this
Then, when cloning your project, you will only have to add the option
--recursive
to make git automatically clone the root repository, and all its submodules.I hope it helps.
The closest thing I have found is https://github.com/bat-cha/gradle-plugin-git-dependencies but I can't get it to work with the android plugin, keeps trying to pull from maven even after the git repos are loaded.
I don't think gradle supports to add a git repo as a dependancy. My workaround is to:
I assume that you want the library repo outside the folder of the main project repo, so each project will be independent git repos, and you can make commits to the library and main project git repos independently.
Assuming you want to have the folder of the library project in the same folder that the folder of the main project,
You could:
In the top level settings.gradle, declare the library repository as a project, given it's location in the filesystem
Use the gradle-git plugin to clone the library from the git repository
In the dependencies of your project, say that the code of your project depends on the folder of the git project