This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 5852
    
    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: 17030
    
  26

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.


An IDE is no substitute for an Intelligent Developer.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Same dependency in multiple repositories
 
It's not a secret anymore!