Jono
Jono

Reputation: 18118

Get dependencies from multiple repo's

Is it possible to download dependencies in maven using multiple plugin-repos?

I have my settings.xml configured to get dependencies from a custom repo and because of this, i am unable to get dependencies from the main maven repo server.

Is this possible to setup more then one plugin Repo?

Here is what i have setup so far for my custom repo:

</profiles>
  <profile>
    <id>custom-config</id>
    <repositories>
      <repository>
        <id>custom-snapshots</id>
        <name>customSnapshots</name>
        <releases>
          <enabled>false</enabled>
          <updatePolicy>always</updatePolicy>
          <checksumPolicy>warn</checksumPolicy>
        </releases>
        <snapshots>
          <enabled>true</enabled>
          <updatePolicy>never</updatePolicy>
          <checksumPolicy>fail</checksumPolicy>
        </snapshots>
        <url>http:/custom/repo</url>
        <layout>default</layout>
      </repository>
    </repositories>

    <pluginRepositories>
      <pluginRepository>
        <id>custom-plugins</id>
        <urlhttp:/custom/repo/public-snapshots</url>
        <releases>
          <enabled>true</enabled>
        </releases>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>

I have not included the dependencies here, but I am unable to pull and resolve some library dependencies.

The maven repo that I use is http://mvnrepository.com/ but I dont have details on the exact repo settings to use as the one I defined for a custom one.

Upvotes: 0

Views: 275

Answers (1)

wemu
wemu

Reputation: 8160

The default maven repository is called "central". Its url is: http://repo1.maven.org/maven2/ or nowadays: http://repo.maven.apache.org/maven2/

But it is usually configured as mirrorOf. If you create a repository in your settings.xml and give it the id *central" it will replace it.

So I wonder why you can't resolve dependencies from there. Usually adding a repository in settings.xml does not turn of central.

could you execute mvn help:effective-settings and mvn help:effective-pom and have a loook at all repositories, profiles and mirrorOf elements in the xml? central should be there.

I would also recommend using a Maven proxy like Nexus or Artifactory. It simplifies a lot of things within a company.

Upvotes: 1

Related Questions