基于阿里云的maven配置settings.xml

本文介绍了如何在Maven中配置镜像源以提高依赖下载速度。通过设置镜像站点,可以指定使用如阿里云等国内镜像站点来代替默认的中央仓库。此外,还展示了如何针对特定JDK版本激活不同的配置文件。
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="         http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  5.     <!--本地仓库。该值表示构建系统本地仓库的路径。其默认值为~/.m2/repository。   
  6.         <localRepository>F:\apache-maven-3.0.4\dependy\repository</localRepository>   
  7.     -->  
  8.     <!--Maven是否需要和用户交互以获得输入。如果Maven需要和用户交互以获得输入,则设置成true,反之则应为false。默认为true。   
  9.         <interactiveMode>true</interactiveMode>   
  10.     -->  
  11.     <mirrors>  
  12.         <!-- mirror | Specifies a repository mirror site to use instead of a given   
  13.             repository. The repository that | this mirror serves has an ID that matches   
  14.             the mirrorOf element of this mirror. IDs are used | for inheritance and direct   
  15.             lookup purposes, and must be unique across the set of mirrors. | -->  
  16.         <mirror>  
  17.             <id>nexus-aliyun</id>  
  18.             <mirrorOf>central</mirrorOf>  
  19.             <name>Nexus aliyun</name>  
  20.             <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
  21.         </mirror>  
  22.         <mirror>  
  23.             <id>net-cn</id>  
  24.             <mirrorOf>central</mirrorOf>  
  25.             <name>Nexus net</name>  
  26.             <url>http://maven.net.cn/content/groups/public/</url>  
  27.         </mirror>  
  28.     </mirrors>  
  29.   
  30.     <profiles>  
  31.         <profile>  
  32.             <id>jdk-1.4</id>  
  33.             <activation>  
  34.                 <jdk>1.4</jdk>  
  35.             </activation>  
  36.             <repositories>  
  37.                 <repository>  
  38.                     <id>nexus</id>  
  39.                     <name>local private nexus</name>  
  40.                     <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
  41.                     <releases>  
  42.                         <enabled>true</enabled>  
  43.                     </releases>  
  44.                     <snapshots>  
  45.                         <enabled>false</enabled>  
  46.                     </snapshots>  
  47.                 </repository>  
  48.             </repositories>  
  49.             <pluginRepositories>  
  50.                 <pluginRepository>  
  51.                     <id>nexus</id>  
  52.                     <name>local private nexus</name>  
  53.                     <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
  54.                     <releases>  
  55.                         <enabled>true</enabled>  
  56.                     </releases>  
  57.                     <snapshots>  
  58.                         <enabled>false</enabled>  
  59.                     </snapshots>  
  60.                 </pluginRepository>  
  61.             </pluginRepositories>  
  62.         </profile>  
  63.     </profiles>  
  64.     <!-- -->  
  65.     <activeProfiles>  
  66.         <activeProfile>nexus</activeProfile>  
  67.     </activeProfiles>  
  68. </settings>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值