Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I’m using Maven 3.2. I have this dependency in my pom.xml file (a WAR project)

            <dependency>
                    <groupId>joda-time</groupId>
                    <artifactId>joda-time</artifactId>
                    <version>1.6.2</version>
                    <scope>provided</scope>
            </dependency>

Whenever I run any phase for my pom (e.g. “mvn install”), the app always attempts to download some metadata about the dependency …

Downloading: http://repo.spring.io/milestone/joda-time/joda-time/maven-metadata.xml

How do I tell Maven to stop doing that? I already have the artifact cached in my local Maven repo.

Thanks, - Dave

like image 687
Dave Avatar asked Oct 24 '14 20:10

Dave


2 Answers

Maybe the update policies need to be specified explicitly. See this answer: Why is Maven downloading the maven-metadata.xml every time?

<pluginRepositories>
<pluginRepository>
    <id>central</id>
    <url>http://gotoNexus</url>
    <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
    </snapshots>
    <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
    </releases>
</pluginRepository>

like image 66
janDro Avatar answered Oct 01 '22 04:10

janDro


This means that somewhere in your dependency tree either a SNAPSHOT or a version-range is used (direct or as transitive dependency). For both cases the solution is the same: lock the version to a specific release. Did you lock it as direct dependency or within dependencyManagement?

like image 34
Robert Scholte Avatar answered Oct 01 '22 05:10

Robert Scholte