• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Same dependency in multiple repositories

 
Shah Jenish
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We have a pom.xml file with few dependencies belongs to two repositories. But there is one dependency jar which is part of both the repositories and at the same path only at both the place.

Is there any way where I can mention in Pom.xml that particular dependency should be taken from a particular repository only?

Thanks,
Jenish
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would hope that they are both the same! Especially if the artifact name is the same.

I think that the order in which you specific the repositories in your settings.xml file (or on your POM) is the order in which Maven looks for the artfiact.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the key features of Maven: that it produces a uniform product from uniform parts. If your 2 different copies of that particular dependency are not identical, then you've lost that guarantee of a uniform product.

I have one project that references something like 5 different repositories. There's a lot of overlap, since several of them allow dual use as your one-and-only repo as well as adding their particular product goodness. If it was a scramble between all these repositories for copies of dependencies, it would be a nightmare of the worst kind. As it is, I don't have to worry about which repo a given dependency gets pulled from.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic