maven安装配置

 

  • 安装
    • 下载二进制分发包,解压
    • 把maven加到PATH中
  • 配置M2_HOME
export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4
  •  配置maven参数
  • vi ~/.m2/settings.xml
  • 添加如下内容
<settings>
  <profiles>
    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>local-repository</id>
          <name>local private repository</name>
          <url>http://192.168.1.211:8081/nexus/content/groups/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>local-plugin-repository</id>
          <name>local private plugin repository</name>
          <url>http://192.168.1.211:8081/nexus/content/groups/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

<profile>
      <id>nexus-snapshots</id>
      <repositories>
        <repository>
          <id>nexus-snapshots</id>
          <name>local private snapshots</name>
          <url>http://192.168.1.211:8081/nexus/content/groups/public</url>
        </repository>
      </repositories>
    </profile>
    <profile>
      <id>nexus-releases</id>
      <repositories>
        <repository>
          <id>nexus-releases</id>
          <name>local private releases</name>
          <url>http://192.168.1.211:8081/nexus/content/groups/public</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

<activeProfiles>
    <activeProfile>nexus</activeProfile>
    <activeProfile>nexus-snapshots</activeProfile>
    <activeProfile>nexus-releases</activeProfile>

  </activeProfiles>


  <servers>
    <server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
</settings>

 

 

你可能感兴趣的:(maven)