aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Same dependency in multiple repositories Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Same dependency in multiple repositories" Watch "Same dependency in multiple repositories" New topic
Author

Same dependency in multiple repositories

Shah Jenish
Greenhorn

Joined: Feb 19, 2009
Posts: 13
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

Joined: May 14, 2008
Posts: 5827
    
    7

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.


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16057
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: Same dependency in multiple repositories