Is there a way to tell maven (when doing mvn package, mvn site or …) not to resolve the dependencies from the local repository?
Background of this question: Sometimes I get into problems, when previously cached dependencies (e.g. SomeProject-0.7-ALPHA) are no longer available in the remote repository. In my local build everything still works fine as the dependency has been cached before. As soon as I share my pom with others, they may get into trouble, as they dont have a cached version of that dependency and the dependency can no longer be resolved from the remote repository.
Any help will be appreciated. Thanks in advance!
No, that’s how the whole dependency resolution works (via the local repository).
Sorry for stating the obvious but removing dependencies from a remote repository is an horrible practice and leads to… well the kind of troubles you’re facing. If possible, avoid doing that.
One way to check that things would work for others would be to purge the dependencies of the project you’re going to share from your local repository and to re-resolve them. Of course, doing this manually would be really painful but the good news is that the Maven Dependency Plugin has a
purge-local-repositorygoal for that.If this fails, then you know that something is missing and can’t be resolved anymore which is basically what you want to know. But you’ve also lost it so make a backup of your repository if this matters to you.