Member-only story
How to Test a Project Dependency Without a Remote Repository
A Guide to publishToMavenLocal from Gradle
Motivation
When you’re working on a library or module and want to test it in other projects without the need for a remote repository.
This can relate to a new project or a new version of an existing one.
I will talk about how to do that with publishToMavenLocal
. The goal is to publish a Java library to the local Maven repository.
I spent some time looking for a solution online before a colleague from work gave me this idea, thanks Nhat.
What is publishToMavenLocal
?
publishToMavenLocal
is a Gradle task that allows you to publish your project's artifacts (such as JARs, POM files, and other resources) to the local Maven repository on your development machine.
This local repository serves as a cache for your locally built artifacts and can be used by other projects as a source of dependencies.
How to find the Local maven repository
- For Linux/Mac:
cd ~/.m2
2. For Windows:
cd %userprofile%