Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to add repositories to local settings.xml

Tags:

maven

maven-3

I'm having trouble getting Maven to download dependencies when I specify my repositories in my .m2/settings.xml file. However, Maven downloads these dependencies when I add the repository names to my pom.

Specifically, I am attempting to compile some hibernate example projects, and I've read in the instructions that I should add the following repositories to either my pom or settings.xml:

    <repositories>
        <repository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Repository Group</name>
          <url>http://repository.jboss.org/nexus/content/groups/public/</url>
          <layout>default</layout>
          <releases><enabled>true</enabled><updatePolicy>never</updatePolicy></releases>
          <snapshots><enabled>true</enabled><updatePolicy>never</updatePolicy></snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>jboss-public-repository-group</id>
            <name>JBoss Public Repository Group</name>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
        </pluginRepositories>    

Everything works fine when I put the snippet in my project's pom.xml, but when I try putting it in settings.xml I receive this error:

The POM for org.hibernate:hibernate-core:jar:3.6.1.Final is missing, no dependency information available

Any ideas what I may be doing wrong?

like image 772
NobodyMan Avatar asked Jan 21 '23 13:01

NobodyMan


1 Answers

You must have specified <repositories> and <pluginRepositories> within <profile> tag of settings.xml. Possibly this profile is not active. Ensure one of the below is present in your settings file.

<activeProfiles>
    <activeProfile>myProfile</activeProfile>
</activeProfiles>

or

<profile>
   <id>myProfile</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   ...   
</profile>
like image 193
Raghuram Avatar answered Jan 29 '23 09:01

Raghuram