Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 789
DeepNightTwo Avatar asked Nov 27 '13 09:11

DeepNightTwo


People also ask

How do I specify Maven central repository in POM xml?

Explicitly Pointing to Maven Central from your POM file. To explicitly configure maven to use Central from your Project Object Model (POM) file, you may do so by adding the following to your pom. xml: This is based on the Maven Default Project which defines the Super POM, or default settings, for all Maven builds.

Can we add repository in POM xml?

Putting non-standard repositories in the pom. xml file (which gets checked into source control) means every developer can build. But YES, your authentication for a repository server should be in your private settings. xml file.

What type of repositories are available in Maven?

There are 3 types of maven repository: Local Repository. Central Repository. Remote Repository.

How does Maven decide which repository to use?

In maven we can define 0 or more repositories where it looks for resources. Repositories can be defined in settings. xml or within your pom. By default if you define no repositories everything will come from a repository name 'central' which is just the default one maintained by maven.


1 Answers

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.

like image 146
carlspring Avatar answered Sep 29 '22 19:09

carlspring