Member-only story

How to Test a Project Dependency Without a Remote Repository

Samuel Teixeira
4 min readAug 15, 2023

--

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.

Just a crazy image generated with AI

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

  1. For Linux/Mac:
cd ~/.m2

2. For Windows:

cd %userprofile%

--

--

Samuel Teixeira
Samuel Teixeira

Written by Samuel Teixeira

Developer (15+ years) | Staff Engineer at IAS | Master of Computer Science | Interests — Backend Dev , Machine Learn, Code performance, System Design

No responses yet