[ 
https://jira.codehaus.org/browse/MNG-5723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356232#comment-356232
 ] 

Michael Osipov commented on MNG-5723:
-------------------------------------

bq. But otherwise,when you say "The standard approach is not to declare any 
repositories, but to use one repo group and just use it", I wonder then why is 
there even an option to declare multiple repositories. If I declare multiple 
repositories, same jar gets downloaded multiple times, which is a big overhead.

The repositories elements existed long before repo manager existed and sevices 
like Sonatype OSS existed. It was a fragmented work. Now with having both, 
those are obsolete in my case. You might to read 
[this|http://blog.sonatype.com/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/]
 and [this|http://stackoverflow.com/a/25666784/696632].

{quote}
Also, if I am a developer who doesnt have nexus and repo group, then I will 
have to rely on declaring multiple repositories. I would assume that jar would 
be downloaded from 1st declared repository. But actually locally I would have 
jar from the last declared repository, which is highly illogical to common 
sense.

And it makes me wonder, why was this feature changed from version 3.1 to 3.2. 
In 3.1 jar once downloaded is not looked up further in other declared 
repositories.
Is there any other problem that this change solves ? 
{quote}

That is clearly a bug.

Are you able to provide an obfuscated but readible debug log?

> Why does maven 3.2 download same artifact multiple times from all 
> repositories defined in pom ?
> -----------------------------------------------------------------------------------------------
>
>                 Key: MNG-5723
>                 URL: https://jira.codehaus.org/browse/MNG-5723
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.2.1, 3.2.2, 3.2.3
>            Reporter: Ruchir Sachdeva
>
> I have defined 2 repositories in pom.xml like below. One is public and other 
> is thirdparty.
>     <repositories>
>        <repository>
>             <id>public</id>
>             <name>Nexus - Public Repositories</name>
>             <layout>default</layout>
>             <url>http://mavenrepo.aaa.net/nexus/content/groups/public</url>
>             <releases>
>                 <enabled>true</enabled>
>             </releases>
>             <snapshots>
>                 <enabled>false</enabled>
>             </snapshots>
>         </repository>       
>         <repository>
>             <id>thirdparty</id>
>             <name>Nexus - Third Party</name>
>             <layout>default</layout>
>             
> <url>http://mavenrepo.aaa.net/nexus/content/repositories/thirdparty</url>
>             <releases>
>                 <enabled>true</enabled>
>                 <updatePolicy>always</updatePolicy>
>             </releases>
>             <snapshots>
>                 <enabled>false</enabled>
>             </snapshots>
>         </repository>       
>     </repositories>
> Say there is a dependency called grpId:artId:1.1.0 which I have defined in my 
> pom. This dependency is present in both the repositories defined above- 
> public and thirdparty 
> When I run mvn install I see different behaviours in the way maven downloads 
> the grpId:artId:1.1.0 artifact based on the version of maven i am using.
> Behaviours :-
> **1. Using Maven 3.1 and previous versions** 
>      
>  - **a.** Maven looks up the dependency grpId:artId:1.1.0 in 'public' repo
>  - **b.** Maven finds the dependency and downloads it.
>  - **c.** Maven does not look up the dependency grpId:artId:1.1.0 in   
>    'thirdparty' repo as it is already downloaded from previous repository.
> **2. Using Maven 3.2** 
>        
>  - **a.** Maven looks up the dependency grpId:artId:1.1.0 in 'public' repo
>  - **b.** Maven finds the dependency in 'public' repo and downloads it.
>  - **c.** Maven again looks up the dependency grpId:artId:1.1.0 in
>    'thirdparty' repo even  though it is already downloaded from 'public' 
> repository.
>  - **d.** Maven finds the dependency in 'thirdparty' repo and downloads it
>    and overwrites the dependency downloaded from 'public' repo previously
> I wonder why maven is behaving in an absurd manner for maven-3.2. It should 
> stop looking further for the dependency which is already resolved and 
> downloaded from one repository .
> Is there a way to achieve it using maven 3.2 ?



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to