How can I get Maven to stop attempting to check for updates for artifacts from a certain group from maven-central-repo?

Tim Gilbert :

I'm working on a fairly big Maven project. We have probably around 70 or so individual artifacts, which are roughly split into two libraries of shared code and maybe ten applications which use them. All of these items live in the namespace com.mycompany.*.

Most of the time we're running against snapshot builds. So to do a full build of an application, I might first build the library projects so that they are installed to my local repository (as, say, mycompany-libname-2.4-SNAPSHOT.jar).

The problem is that when I then go build the applications. For some reason, Maven wants to check the main two public repositories (maven-net-repo and java-net-repo) for updates for all of the mycompany-*-SNAPSHOT.jar artifacts. Of course, they aren't found there, and everything eventually resolves back to the versions I just built to my local repository, but I'd like Maven to stop doing this because (a) it makes me feel like a bad net.citizen for constantly checking these repositories for things that will never be there, and (b) it adds some unnecessary and annoying network latency into my build process.

I've taken to running maven in offline mode most of the time to work around this, but that's not ideal since occasionally a dependency on a public library will be updated. So what I'm looking for is a solution which will cause Maven not to check for updates from given repositories for artifacts which meet certain criteria - in this case, I'd be happy if Maven would ignore either SNAPSHOT versions or artifacts which were in the com.mycompany namespace.

Dennis Lassing :

The updatePolicy tag didn't work for me. However Rich Seller mentioned that snapshots should be disabled anyways so I looked further and noticed that the extra repository that I added to my settings.xml was causing the problem actually. Adding the snapshots section to this repository in my settings.xml did the trick!

<repository>
    <id>jboss</id>
    <name>JBoss Repository</name>
    <url>http://repository.jboss.com/maven2</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Could not transfer artifacts from/to central maven repo when using Spring Framework Cloud

How to assume bintray ownership of a repo copied from maven central

How to use a specific (not default) jar from maven central repo with maven? (hive-exec)

How can I deploy artifacts from a Maven build to the SourceForge File Release System?

Utility for downloading artifacts from maven repo without mvn/poms

How can I push a large dependency tree from maven central to a local Archiva server?

Azure blob storage 12.5.0 dependency removed from maven central repo

How do I get maven artifacts into the Jenkins maven repository?

How to upload artifacts to maven central with gradle and the maven plugin via a proxy

Can I resolve one Maven dependency from one repo and another dependency from second repo in same POM?

How can I prevent Maven from checking for updates from repositories that I don't list in my settings.xml file?

how to reference native DLL from Maven repo?

How can I download Maven artifacts within a plugin?

Maven: how can I deploy two artifacts with the release plugin?

How can I deploy spark artifacts to a custom maven repository?

I get an error downloading javax.media.jai_core:1.1.3 from maven central

Can't fetch jug 2.0.0 from Maven Central using Gradle

What is the way to get bot-java lib from maven central

Resolve maven repo group from incomplete APK reference

Maven: How to unpack precise files from artifacts in the same output directory?

How to stop Maven from overwriting resource files

how to exclude maven central repository from mirror and access it directly?

How to build nifi processor nar file and dependencies from maven central

How can I ban Software Updater from checking for updates at certain times of day or certain days of week?

How can I eliminate certain values (zeros) and get the maximum value from some data group?

How do I prevent Maven from downloading maven-metadata.xml for an artifact that I already have in my repo?

Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2)

How do I clone a repository from git but still get updates made to the original repo?

IntelliJ/Maven not updating artifacts from Artifactory