【Maven】【02】Maven的settings配置建议

1.修改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:\Program Files\apache-maven-3.6.0\repo</localRepository>

  <servers>
    <server>
        <id>my_nexus_release</id>
        <username>deployment</username>
        <password>deploymentxxx</password>
    </server>
    <server>
        <id>my_nexus_snapshots</id>
        <username>deployment</username>
        <password>deploymentxxx</password>
    </server>
  </servers>

   <profiles>
	   <profile>
          <id>my_nexus</id>
            <repositories>
             <repository>
                 <id>my_nexus</id>
                 <url>http://ip地址:端口号/nexus/content/groups/public/</url>
                 <releases>
                    <enabled>true</enabled>
                 </releases>
                 <snapshots>
                    <enabled>true</enabled>
                 </snapshots>
             </repository>
             <repository>
                  <id>aliyun</id>
                  <url>http://maven.aliyun.com/nexus/content/groups/public</url>
             </repository>           
            </repositories>           
            <pluginRepositories>
               <pluginRepository>
                    <id>my_nexus</id>
                    <url>http://ip地址:端口号/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
               </pluginRepository>
               <pluginRepository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
               </pluginRepository>              
            </pluginRepositories>
      </profile>
    </profiles>
	
	<!-- 激活 -->
	<activeProfiles>
		<activeProfile>my_nexus</activeProfile>
	</activeProfiles>

</settings>

2.Servers的配置,配置了私服的用户名和密码和项目中的pom的以下配置配合使用

注意:id保持一致

<distributionManagement>
        <repository>
            <id>my_nexus_release</id>
            <name>my_nexus Release Repository</name>
            <url>http://ip地址:端口号/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>my_nexus_snapshots</id>
            <name>my_nexus Snapshot Repository</name>
            <url>http://ip地址:端口号/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值