Alexander Mills
Alexander Mills

Reputation: 100386

How to skip local dependencies using Maven

I have a local jar project like so:

    <groupId>com.oresoftware</groupId>
    <artifactId>async.0.1</artifactId>
    <packaging>jar</packaging>
    <version>0.1.101</version>
    <name>org.ores.async.Asyncc</name>
    <url>https://github.com/ORESoftware/async.java</url>

in another Maven project, I refer to it with:

<dependency>
  <groupId>com.oresoftware</groupId>
  <artifactId>async.0.1</artifactId>
  <version>0.1.101</version>
</dependency>

if I run mvn clean install from my library, I believe the other project will use the local dependency. My question is - how can I test the dependency that comes from the network?

mvn clean install -DskipLocalDeps

Is there some maven command that can ignore locally created dependencies? And only install dependencies retrieved from the network?

update:

I think one solution would just be to delete the folder in .m2 and then reinstall in the test project:

rm -rf ~/.m2/com/oresoftware
mvn clean install

then it will have to go to the network to try to find the dep. I am sure this will work, but not sure if it's the optimal workflow

Upvotes: 0

Views: 573

Answers (1)

user8784370
user8784370

Reputation:

No, that's how the whole dependency resolution works (via the local repository). First it will check in local repository and if not present in the local repository then in central repository.

Upvotes: 1

Related Questions