Maven mirror configuration

Today i got the question if it was possible to configure a repository directly in the pom file without specifying the repository in our internal nexus server. This is possible as described in the Maven mirror quide.

configuration

We configured a nexus server to control the used dependencies and ensure that all developers are using the correct versions. Therefore we configured the following in our settings.xml

<mirrors>
  <mirror>
    <id>nexus</id>
    <mirrorOf>*</mirrorOf>
    <url>http://nexus:8081/nexus/content/groups/public</url>
  </mirror>
</mirrors>

All repostiory request that mach ‘*’ will be redirected to the nexus server.

We wanted to avoid this rule to test some packages before configure this in our nexus server. To exclude a repositories you specify multiple fliters by using a comma as the delimiter.

in our case we adjusted the setting.xml to match the following configuration.

<mirrors>
  <mirror>
    <id>nexus</id>
    <mirrorOf>*,!http://labs.consol.de/maven/*</mirrorOf>
    <url>http://nexus:8081/nexus/content/groups/public</url>
  </mirror>
</mirrors>

here some extra examples:

  • * = everything
  • external:* = everything not on the localhost and not file based.
  • repo,repo1 = repo or repo1
  • *,!repo1 = everything except repo1

Popularity: 3% [?]

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Maven mirror configuration”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>