Maven·3rd(各种配置)
来源:互联网 发布:java单例模式好处 编辑:程序博客网 时间:2024/06/16 02:17
引言
本篇我们介绍,我们主要介绍Maven中常用设定的配置方法
代理服务器配置
有时候我们本地执行Maven命令的时候,偶尔会发生如下error。
(https://repo.maven.apache.org/maven2): connect timed out
方法1:配置文件:C:\Users\【UserName】\.m2\settings.xml
在此文件中加入以下设定内容:
<proxies> <proxy> <id>proxy</id><!--代理服务器ID(任意值)--> <active>true</active><!--true设定时候,表示当前此代理为激活状态--> <protocol>https</protocol><!--协议,http或https比较常用,在此推荐使用https--> <host>www.proxy.com</host><!--代理服务器地址(根据实际情况进行修改)--> <port>80</port><!--代理服务器端口(根据实际情况进行修改)--> <username>usr</username><!--代理服务器用户名(根据实际情况进行修改)--> <password>psw</password><!--代理服务器密码(根据实际情况进行修改)--> <!--指定访问哪些主机的时候,是不需要使用以上代理的,如果是多个主机地址需要指定的话,中间用“|”分割,并且可使用通配符--> <nonProxyHosts>localhost</nonProxyHosts> </proxy> </proxies>
方法2:配置文件:%MAVEN_HOME%\confg\settings.xml
在此文件中加入以下设定内容:
<proxies> <proxy> <id>proxy</id><!--代理服务器ID(任意值)--> <active>true</active><!--true设定时候,表示当前此代理为激活状态--> <protocol>https</protocol><!--协议,http或https比较常用,在此推荐使用https--> <host>www.proxy.com</host><!--代理服务器地址--> <port>80</port><!--代理服务器端口--> <username>usr</username><!--代理服务器用户名--> <password>psw</password><!--代理服务器密码--> <!--指定访问哪些主机的时候,是不需要使用以上代理的,如果是多个主机地址需要指定的话,中间用“|”分割,并且可使用通配符--> <nonProxyHosts>localhost</nonProxyHosts> </proxy> </proxies>
※Eclipse使用Maven时,出现[connect timed out]的话,使用方法1比较有效。
本地仓库路径配置
配置文件:%MAVEN_HOME%\confg\settings.xml
在此文件中加入以下设定内容:
<localRepository>X:\your path\to your\maven repository</localRepository>
远程仓库镜像的配置
默认远程仓库镜像地址:
%M2_HOME%\lib\maven-model-builder-X.Y.Z.jar
→ pom-4.0.0.xml
→ https://repo.maven.apache.org/maven2
配置文件:%MAVEN_HOME%\confg\settings.xml
在此文件中加入以下设定内容:
方法1:
在setting.xml中找到…………的位置。
在…………中间加入你想要的仓库的标签。
<mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror>
方法2:配置文件:C:\Users\【UserName】.m2\settings.xml
在此文件中加入以下设定内容:
<profiles> <profile> <id>dev</id> <repositories> <repository> <id>Maven aliyun Mirror</id> <name>Maven aliyun Mirror</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> <releases> <enabled >true</enabled> </releases> <snapshots> <enabled >false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>Maven aliyun Mirror</id> <name>Maven aliyun Mirror</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>
※方式2 适用Eclipse中设定需求。
※常用的国内远程仓库:
★http://maven.aliyun.com/nexus/content/groups/public/
★http://maven.aliyun.com/nexus/content/repositories/central/
参考文档
http://www.techscore.com/
https://qiita.com/tarosa0001/items/e5667cfa857529900216
- Maven·3rd(各种配置)
- maven install 3rd-party jars
- Maven无法正常加载nexus私服3rd party中类库
- (十一)Maven远程仓库的各种配置
- Maven远程仓库的各种配置
- Maven远程仓库的各种配置
- Maven远程仓库的各种配置
- UE4学习笔记3rd:配置游戏输入
- maven学习笔记3 各种maven依赖
- symbian 来电拦截(S60 3rd)
- Maven自定义上传第三方包到3rd party(第三方无依赖jar和本地扩展类加入maven统一管理)
- ubuntu当中配置MAVEN遇到的各种问题
- April 3rd
- 3rd post
- My 3rd Times!
- 3G "3rd Generation"
- 3rd Generation
- August 3rd Monday
- SpringMVC创建
- 【Scikit-Learn 中文文档】神经网络模块(监督的)- 监督学习
- java输入输出流
- 超链接的target属性使用
- request.getParameter() 和request.getAttribute() 区别
- Maven·3rd(各种配置)
- Android跳转到应用商店详情页面
- LeetCode-4(Excel列号转换)
- 关于ARM的统一编制与内存映射机制
- 犀利的 oracle 注入技术
- Spark2.2 TaskScheduler原理剖析与源码分析
- 【Scikit-Learn 中文文档】高斯混合模型
- Git使用手册:git branch 分支操作、创建分支、查看分支、删除分支、删除本地分支、删除远程分支
- Fiori2.0学习笔记-Fragment