Repositories specified in pom.xml are not used by maven?

maven, repository

Solution

Posting my guess as an answer.

Your problem seems to be that in your `settings.xml` you have a `<mirrors/>` section which is overriding the repositories defined in your `pom.xml`.

Problem

I am compiling HBase using Maven3. The pom from github https://github.com/cloudera/hbase/blob/cdh4-0.94.2_4.2.1/pom.xml specified some repositories to provide some external jars. But maven 3 doesn't look for jars from these repositories and just throws exception says the jar is not found from mirror. Here is the repositories from pom. ``` <repositories> <repository> <id>cdh.repo</id> <url>https://repository.cloudera.com/artifactory/cloudera-repos</url> <name>Cloudera Repositories</name> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>cdh.snapshots.repo</id> <url>https://repository.cloudera.com/artifactory/libs-snapshot-local</url> <name>Cloudera Snapshots Repository</name> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> <repository> <id>apache release</id> <url>https://repository.apache.org/content/repositories/releases/</url> </repository> <repository> <id>apache non-releases</id> <name>Apache non-releases</name> <url>http://people.apache.org/~stack/m2/repository</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>java.net</id> <name>Java.Net</name> <url>http://download.java.net/maven/2/</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>codehaus</id> <name>Codehaus Public</name> <url>http://repository.codehaus.org/</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>repository.jboss.org</id> <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>ghelmling.testing</id> <name>Gary Helmling test repo</name> <url>http://people.apache.org/~garyh/mvn/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> ``` -----------------------updated 2013-11-28 13:53---------------------------- My bad. The problem is ``` <mirrors> <mirror> <id>public</id> <mirrorOf>*</mirrorOf> <url>http://mavenrepo.mycorp.com:8081/nexus/content/repositories/public</url> </mirror> </mirrors> ``` `<mirrorOf>*</mirrorOf>` should be `<mirrorOf>central</mirrorOf>`. By using *, it will be used to handle all download request of all repos. And surely the repo of company doesn't mirror 3rd part repos resources

Original source