Nitish Goyal
Nitish Goyal

Reputation: 107

How to manage dependancy of a project in another Git repo using gradle?

I had a sub-project residing in a Git repo (X). I moved that project into a new Git repo (Y) and want to use dependencies from repo X. How can I manage dependencies?

Upvotes: 1

Views: 120

Answers (1)

robjwilkins
robjwilkins

Reputation: 5652

Build the code from Repo X and push it to a maven/nexus type repository. There are details on how to do this here: https://docs.gradle.org/current/userguide/maven_plugin.html#uploading_to_maven_repositories

In the subproject you can now resolve the dependency by setting up the dependency as you would for any other.

In the build.gradle script for sub-project you can add a new repository declaration and specify the details for the nexus/maven repo that you pushed the artifact to. For example:

repositories {
    maven {
        url "http://repo.x"
    }
}

Upvotes: 1

Related Questions