I run a maven build and I see the same artifact downloaded several times. After a successful download from one repo, a download from another repo is attempted. Some downloads are (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
The 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>
You can force Maven to use a single repository by having it mirror all repository requests. The repository must contain all of the desired artifacts, or be able to proxy the requests to other repositories. This setting is most useful when using an internal company repository with the Maven Repository Manager to proxy external requests.
To achieve 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.
If you look at the log information, you will see that it did not download multiple 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 same and at the end of the second INFO, it says 0 B at 0.0 KB/sec
that means, it was not downloaded.
It's not downloading it multiple times. It's not able to find it in the first repository, so it's trying the next one on your <repositories/>
list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With