• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Repositorys in Maven

 
Praful Thakare
Ranch Hand
Posts: 642
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have to use two different locations to download different set of jar file, I am very new to Maven so need some basic help.

I added both the repository under <repositories> tag,but the build fails for the files for second repository, i don't know how do i tell maven that for a perticular dependency use different repository ?

-P
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I think I've overdone it on this one, but I don't want to break anything finding out!
 
Praful Thakare
Ranch Hand
Posts: 642
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much tim, i have similar POM but i wonder how maven understand what repository to use for a given artifact?

i have all required files defined in <dependency> as below.



now i have a repos for files in 2nd dependency tag and NEW repos for 1st Dependency tag so i added new repository tag as below



so for files mention in first depdencey it searches repos 1 where as its located in repos 2.

-P
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is - "all of them"!

Maven is based on the idea that anything in a repository is a fixed release, and once released, it will never change. So which repository you get a release from is immaterial - one is as good as another.

If you make fuzzy version requests, this can cause trouble, since there's a possibility of catching a release that wasn't propagated to other participating repositories. But making fuzzy version requests is a good way to ensure getting Maven's version of DLL Hell. I recommend always keying for specific releases unless there's a strong reason not to.

There probably is something like a "best-fit" rule that gets around problems where different versions have different, but equally eligible releases. I haven't checked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic