Saturday, September 8, 2012

Configure remote repository for Maven

Remote repository can be changed by configuring settings.xml in conf folder of maven. 

<?xml version="1.0" encoding="UTF-8"?>


<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <!--
  Maven local repository defaults to ~/.m2/repository.
To change the path to the local repository, have the following tag.
  -->
 <localRepository>/path/to/local/repo</localRepository>


  <pluginGroups>
  </pluginGroups>
  <proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>

  <servers>

    <!-- 
To configure your credentials to access the remote repository
    -->
    <server>
      <id>xxxxx</id>
      <username>your_username</username>
      <password>your_password</password>
    </server>

  </servers>


  <mirrors>

    <!--
Remote repository can be configured here.
     -->
    <mirror>
      <id>artifactory</id>
      <mirrorOf>*</mirrorOf>
      <name>my repo name</name>
      <url>https://www.location_of_my_repo/repo</url>
    </mirror>

  </mirrors>

  <profiles>
    <!-- profile
    <profile>
      <id>jdk-1.4</id>
      <activation>
        <jdk>1.4</jdk>
      </activation>
      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->
  </profiles>
</settings>

thanks,
Shyarmal.

No comments:

Post a Comment