Use Artifacts from mavenLocal Repository

I want to use an artifact which i published it in mavenLocal repository , how can i get that artifact ??

I think you add mavenLocal() to repositories and then implementation with the string defining your group id, package name and version number under dependencies.

1 Like

Thank you.
i done this. but i still have compilation error, i dnt understand what you mean about “implementation” , have you an example??

like that ???

implementation ‘org.gradle.sample:monJar:1.1’

implementation refers to a dependency configuration, as you guessed.

For information on adding Maven Local to your build’s dependency repositories, see this chapter of the user manual. I recommend putting mavenLocal() after the main repository. For example:

repositories {

Then you just declare your dependencies as normal, like this:

dependencies {
    implementation 'org.gradle.sample:monJar:1.1'
1 Like

ok thank you so much

This will always go Maven central. Only artifacts not available in central will be taken from maven local repo.

Correct, and thanks for clarifying the situation. My assumption was that anything you wanted to pick up from Maven local would not be in Maven Central.

In my view, Maven Central should be prioritised as the definitive source of published artifacts. Maven Local is too prone to corruption. And you generally want the main source of artifacts to be first in the list to reduce the number of HTTP requests the dependency management system sends.


I recommend that you put mavenLocal() last in the repos list. Otherwise you will have issues.

1 Like