Maven 2.x settings.xml file

  1. Create a new xml file in your user home directory in the .m2 directory called settings.xml
  2. Add the following lines:
    <settings xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <profiles>
        <profile>
          <id>tomcat5x</id> 
          <activation>
            <activeByDefault>true</activeByDefault> 
          </activation>
          <properties>
            <appserver.id>tomcat5x</appserver.id> 
            <appserver.home>/opt/tomcat</appserver.home> 
            <maven.tomcat.home>/opt/tomcat</maven.tomcat.home> 
            <sakai.appserver.home>/opt/tomcat</sakai.appserver.home> 
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.useFile>false</surefire.useFile>
          </properties>
        </profile>
      </profiles>
    </settings>
    
    • Note: Unfortunately, Sakai does not use the standard appserver.home so you have to specify a sakai.appserver.home
    • Note: The sakai.appserver.home must be C:\opt\tomcat for windows users
    • Note: Do not include trailing / or \ slashes in the directory paths
  • (optional) You can specify the tomcat home to be an environment variable like so:
          <maven.tomcat.home>${env.CATALINA_HOME}</maven.tomcat.home>
    
  • (optional) Users who use a network proxy need to add the following to their file
    ...
      <proxies>
         <proxy>
            <active>true</active>
            <protocol>http</protocol>
            <host>www.your.proxy.host</host>
            <port>80</port>
            <username>your_username</username>
            <password>your_password</password>
            <nonProxyHosts>localhost</nonProxyHosts>
         </proxy>
      </proxies>
    </settings>
    
    • If you do not use a username or password for your proxy just leave out those 2 lines
    • You only need the nonProxyHosts option if you have a local maven repo that does not require the proxy to be accessed
    • Note: Maven 2 doesn't support Microsoft's NTLN authentification scheme. If you connect to a proxy like ISA you will need to use a tool, such as http://ntlmaps.sourceforge.net/ to proxy your traffic