středa 8. prosince 2010

How to add custom repository to Maven with M2Eclipse plugin

In your users settings.xml file create new profile with repositories tag filled and default activation enabled. After this you will get new repository in command line maven and in your Eclipse environment.


<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">
 <profiles>
  <profile>
   <id>java.net-repository</id>
   <activation>
    <activebydefault>true</activeByDefault>
   </activation>
   <repositories>
    <repository>
     <id>maven2-repository.dev.java.net</id>
     <name>Java.net Repository for Maven</name>
     <url>http://download.java.net/maven/2/</url>
     <layout>default</layout>
    </repository>
   </repositories>
  </profile>
 </profiles>
</settings>

Note: There is difference between <activebydefault>true</activeByDefault> and <activebydefault/>.