How to have Maven build dependency from local Maven project instead of download?

2498 views java

I am working on 2 Java maven projects A and B, and A depends on B. Both projects are github repositories which I have cloned on my local machine.

I made some changes to B and want to test it out with project A now.

When I run the tests in project A, how do I tell Maven to use my local copy of B rather than download a jar file of B from the internet?

answered question

1 Answer


There are few possible ways:

  1. Switch to offline mode with mvn -o. That way you will be only using local repository.

  2. Build and install new version of B which is only available in local repository e.g. 1.0.1-SNAPSHOT. The update A pom.xml to use this new version.

Check out Introduction to Repositories docs to understand what are repositories and how they work.

posted this

Have an answer?


Please login first before posting an answer.