Reto Höhener
Reto Höhener

Reputation: 5870

How can I check if a dependency exists in a remote repository?

I tried with dependency:get or dependency:copy, but those goals will also resolve from my local repo.

Next I tried to make a simple download from https://repo.company.com/repo/<path-to-group>/<artifactId>/<version>/<artifactId>-<version>.pom, but that fails because of missing permissions. I guess that's why I tried to use a plugin, in order to use the existing maven credentials.

Context: Writing a deployment script that should avoid overwriting existing artifacts in our company repo.

Upvotes: 1

Views: 653

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35853

A simple approach would be dependency:get, but overriding the local repository on command line with an empty (temporary) directory.

But, as was already said, Artifactory and Nexus are usually configured in a way that they do not override existing artifacts.

local repo override: -Dmaven.repo.local=...

Upvotes: 1

Related Questions