1

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?

CowZow
  • 1,275
  • 2
  • 17
  • 36
  • Possible duplicate of [How do I configure Maven for offline development?](https://stackoverflow.com/questions/7233328/how-do-i-configure-maven-for-offline-development) – csalmhof Nov 06 '18 at 22:55

1 Answers1

1

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. Then update A pom.xml to use this new version.

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

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
  • 1
    I vote (2) - so that it's clear you're using a version that is not the public one. Even better, put your name in the version, rather than just updating the version number - to make it reallly obvious you're referencing your own version, not one that somehow hasn't made it to the public repo yet... – moilejter Nov 07 '18 at 02:37