Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: metadata xml files downloaded often from remote repositories

Tags:

java

maven

jibx

I'm using Maven to handle a Java project. I thought that Internet connectivity was only needed in the 1st compile to download the required libraries from the remote repositories, but I get several download messages whenever I compile code. Messages like these:

Downloading: http://repo.maven.apache.org/maven2/org/eclipse/core/resources/maven-metadata.xml
Downloading: http://repository.springsource.com/maven/bundles/external/org/eclipse/core/resources/maven-metadata.xml
Downloading: http://repository.springsource.com/maven/bundles/release/org/eclipse/core/resources/maven-metadata.xml
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/eclipse/core/resources/maven-metadata.xml

Why that happens and how I could prevent it?

like image 886
Alan Evangelista Avatar asked Aug 09 '12 13:08

Alan Evangelista


2 Answers

This usually happens when no version information is specified for the artifact.

maven-metadata.xml is a file which contains the <groupId>, <artifactId> and the versioning information about the various versions available for the dependency.

If the version of the artifact is not specified in the pom.xml, maven downloads this metadata file to check if the local repository contains the latest version.

So, you can avoid this download by specifying the version information of the artifact in pom.xml file, instead of changing the update policy which might affect the update process of other jar files in future.

like image 61
r9891 Avatar answered Nov 28 '22 11:11

r9891


The most important thing is to start using a repository manager furthermore check the configuration in your settings.xml file which can be configured to check the remote repositories (update policy).

like image 32
khmarbaise Avatar answered Nov 28 '22 09:11

khmarbaise