Reputation: 29290
I have just edited the <repositories />
section of my pom.xml
file for a project, removing a couple of repo's I thought were unneeded.
I'd like to validate that the declared dependencies are still resolvable in the available repositories.
However, all of the declared dependencies are available in my local repo, so any attempt to build will just use the local ones.
I don't want to simply nuke my local repo, as it takes many hours to download all the dependencies from scratch.
Similarly, I'm not interested in having maven attempt to download all the dependencies, I just want it to ensure that they're all resolvable (including transitive dependencies).
How do I do this?
Upvotes: 13
Views: 34287
Reputation: 1622
Maybe this is not the answer but for some reason I have html in pom files so sometimes I add Mvn dependency to pom.xml at the begining:
<repositories>
<repository>
<id>mvn</id>
<name>mvn</name>
<url>http://maven.icm.edu.pl/artifactory/repo/</url>
</repository>
...other resps
and remove whole .m2/repositories dir or I search for broken files with :
grep -R -l -L groupId --include \*.pom //Search all that not contain groupId string
(execute this in .m2 dir)
Upvotes: 0
Reputation: 907
run
mvn dependency:analyze
it will check dependencies for you.
ref: http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
Upvotes: 15
Reputation: 4525
I assume you have tried mvn validate -U ? I'm no great maven expert but that's what I'd try. (Although I quite regularly blast my local non-third-party report to make absolutely sure the build will work for everyone else).
Upvotes: 0
Reputation: 100051
Empty your local repo (rm -rf ~/.m2/repository) and build.
You can't fix the problem of this being time-consuming. There's no way to know if a particular artifact is in a particular external repo without downloading it. If maven just asked 'have you got X?' you'd get false positives from broken artifacts, which are endemic in some repos.
Upvotes: 1
Reputation: 32617
Well, if you're willing to knock up your own plugin, something that springs to mind would be to have the plugin resolve only the checksums. These checksums are only deployed to the remote repository, after the respective jar/war/zip/whatever artifacts have been already been deployed.
If it takes hours to download all the artifacts, well, then you clearly need a repository manager such as Nexus, or Artifactory, like Karl-Heinz already suggested. It will keep cached versions of your remote artifacts and downloading from it would be a sort matter of time.
Upvotes: 0
Reputation: 97427
The first thing i can say is not to define repositories in a pom, cause it will cause many problems in particular for others who are using this project. Furthermore i recommend to use a repository manager which will solve the problem and improve performance during download and will simplify the check of such circumstances which means simply delete the local repo and try to build.
Upvotes: 2
Reputation: 4732
Emptying the local repo seems to be the only option. This link may help prevent maven to resolve dependencies in local repository.
Upvotes: 1