Question

I've discovered today, while investigating a bug regarding my project being no more deployable, that maven tries to load dependencies from all available repositories. I don't find it wise, specifically regarding our internal artifacts, that are searched on amven central, Sonatype FlexMojos, and other external release repositories (specificall when the last one provides a custom 404 page that maven wrongly interprets as valid content, replacing my valid artifact with an invalid one).

So, is is possible to tell maven which repositories to lookup for SNAPSHOTs artifacts, and which to lookup for RELEASE ones ?

Was it helpful?

Solution

Would it help if you made it explicit to not look for snapshots in your repo?

 <repositories>
   <repository>
     <id>central</id>
     <name>Maven Repository Switchboard</name>
     <layout>default</layout>
     <url>http://repo1.maven.org/maven2</url>
     <snapshots>
       <enabled>false</enabled>
     </snapshots>
   </repository>
 </repositories>

OTHER TIPS

My solution is to set up a repository mirror in the intranet. That way, Maven needs to know a single URL to download everything.

I then use the internal mirror to bundle repositories (local and remote ones). If snapshot repos are first in the search path, the mirror server will almost never publish the names of my internal artifacts (only when I forgot to deploy them).

On top of that, it will reduce the download times for the rest of the team plus it will make sure that everyone can still work even when there are network problems outside of your control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top