Maven配置

下载地址:https://maven.apache.org

settings.xml配置

<?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">
  <localRepository>d:\m2\repository</localRepository>
  <proxies>
    <proxy>
      <id>normal</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>deployment</username>
      <password>deploy123</password>
      <host>10.0.0.13</host>
      <port>8081</port>
      <nonProxyHosts>10.0.0.13</nonProxyHosts>
    </proxy>
  </proxies>
  <servers> 
    <server>
       <id>nexus-releases</id>
       <username>deployment</username>
       <password>deploy123</password>
     </server>
     <server>
       <id>nexus-snapshots</id>
       <username>deployment</username>
       <password>deploy123</password>
    </server>
  </servers>
  <mirrors>
    <mirror>
      <!--This is used to direct the public snapshots repo in the 
          profile below over to a different nexus group -->
      <id>nexus-public-snapshots</id>
      <mirrorOf>public-snapshots</mirrorOf>
      <url>http://10.0.0.13:8081/nexus/content/groups/public-snapshots</url>
    </mirror>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://10.0.0.13:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  
  <profiles>
    <profile>
      <id>development</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <!--this profile will allow snapshots to be searched when activated-->
      <id>public-snapshots</id>
      <repositories>
        <repository>
          <id>public-snapshots</id>
          <url>http://public-snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>public-snapshots</id>
          <url>http://public-snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>development</activeProfile>
  </activeProfiles>
</settings>

配置环境变量

set MAVEN_HOME = D:\apache-maven-3.3.9
set Path = %Path%;%MAVEN_HOME%\bin

测试

mvn -version
    原文作者:Kosh
    原文地址: https://www.jianshu.com/p/fd529dcd14b9
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞