Why does maven download the same artifact multiple times?

I run the maven build and I see the same artifact downloaded several times. After a successful boot from one repo, an attempt to boot from another repo. Some downloads (0 B at 0.0 KB / sec).

[INFO] Downloading: https://p-nexus.mycompany.com/nexus/content/repositories/Myproject-group/aopalliance/aopalliance/1.0/aopalliance-1.0.jar [INFO] Downloaded: https://p-nexus.mycompany.com/nexus/content/repositories/Myproject-group/aopalliance/aopalliance/1.0/aopalliance-1.0.jar (5 KB at 59.8 KB/sec) [INFO] Downloading: https://p-nexus.mycompany.com/nexus/content/repositories/public/aopalliance/aopalliance/1.0/aopalliance-1.0.jar [INFO] Downloaded: https://p-nexus.mycompany.com/nexus/content/repositories/public/aopalliance/aopalliance/1.0/aopalliance-1.0.jar (0 B at 0.0 KB/sec) [INFO] Downloading: http://repo.spring.io/ext-release-local/aopalliance/aopalliance/1.0/aopalliance-1.0.jar [INFO] Downloading: http://repo.spring.io/milestone/aopalliance/aopalliance/1.0/aopalliance-1.0.jar [INFO] Downloading: http://repo.spring.io/snapshot/aopalliance/aopalliance/1.0/aopalliance-1.0.jar 

Repository Configuration:

  <repositories> <repository> <id>Myproject-group</id> <name>Myproject-group</name> <layout>default</layout> <url>https://p-nexus.mycompany.com/nexus/content/repositories/Myproject-group/</url> <snapshots> <enabled>false</enabled> <updatePolicy>never</updatePolicy> </snapshots> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> </repository> </repositories> 
+7
maven nexus
source share
3 answers

You can force Maven to use a single repository, as it mirrors all repository requests. The repository must contain all the necessary artifacts or be able to proxy requests to other repositories. This option is most useful when using the company's internal repository with Maven Repository Manager for proxy external requests.

To do this, set mirrorOf to *.

 <settings> ... <mirrors> <mirror> <id>internal-repository</id> <name>Maven Repository Manager running on repo.mycompany.com</name> <url>http://repo.mycompany.com/proxy</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors> ... </settings> 

more details here

hope this helps.

+3
source share

If you look at the log information, you will see that it has not been downloaded several times.

 [INFO] Downloaded: https://p-nexus.mycompany.com/nexus/content/repositories/Myproject-group/aopalliance/aopalliance/1.0/aopalliance-1.0.jar (5 KB at 59.8 KB/sec) [INFO] Downloaded: https://p-nexus.mycompany.com/nexus/content/repositories/public/aopalliance/aopalliance/1.0/aopalliance-1.0.jar (0 B at 0.0 KB/sec) 

As you can see, their paths are different, even if the jar files are the same and at the end of the second INFO they say 0 B at 0.0 KB/sec , which means that it was not loaded.

+2
source share

He does not download it several times. He cannot find it in the first repository, so he is trying to use the next in your list of <repositories/> .

+1
source share

All Articles