『搭建中小型互联网公司后台服务架构』二、后台服务工具maven安装配置
2018-03-05 15:34
861 查看
后台服务工具maven:maven安装配置1、 maven下载下载地址:https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz2、 解压配置全局变量用工具进行解压。全局变量:/etc/profile用户变量:~/.bash_profile export M3=/Users/heimabb/Documents/maven/apache-maven-3.3.9export PATH=$PATH:$M3/bin验证:命令:mvn -versionApache Maven 3.3.9(bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)Maven home:/Users/heimabb/Documents/maven/apache-maven-3.3.93、maven本地资源库设置主要讲解settings.xml的配置,以及本地资源库的设置
maven的配置文件settings.xml存在于两个地方:
1.安装的地方:${M3_HOME}/conf/settings.xml 全局配置
2.设置
<localRepository>D:/java/mvn_repository</localRepository>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus Aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
repository是做什么的?
2者有什么联系和区别呢?
简单点来说,repository就是个仓库。maven里有两种仓库,本地仓库和远程仓库。远程仓库相当于公共的仓库,大家都能看到。本地仓库是你本地的一个山寨版,只有你看的到,主要起缓存作用。当你向仓库请求插件或依赖的时候,会先检查本地仓库里是否有。如果有则直接返回,否则会向远程仓库请求,并做缓存。你也可以把你做的东西上传到本地仓库给你本地自己用,或上传到远程仓库,供大家使用。
远程仓库可以在工程的pom.xml文件里指定,楼上两位已经列的很清楚了。如果没指定,默认就会把下面这地方做远程仓库,即默认会到http://repo1.maven.org/maven2这个地方去请求插件和依赖包。 <repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository> mirror就是镜像,主要提供一个方便地切换远程仓库地址的途径。比如,上班的时候在公司,用电信的网络,连的是电信的仓库。回到家后,是网通的网络,我想连网通的仓库,就可以通过mirror配置,统一把我工程里的仓库地址都改成联通的,而不用到具体工程配置文件里一个一个地改地址。
4、 ecplise中maven配置
maven的配置文件settings.xml存在于两个地方:
1.安装的地方:${M3_HOME}/conf/settings.xml 全局配置
2.设置
<localRepository>D:/java/mvn_repository</localRepository>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus Aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Maven里面mirror元素和repository元素的作用
mirror 是做什么的?repository是做什么的?
2者有什么联系和区别呢?
简单点来说,repository就是个仓库。maven里有两种仓库,本地仓库和远程仓库。远程仓库相当于公共的仓库,大家都能看到。本地仓库是你本地的一个山寨版,只有你看的到,主要起缓存作用。当你向仓库请求插件或依赖的时候,会先检查本地仓库里是否有。如果有则直接返回,否则会向远程仓库请求,并做缓存。你也可以把你做的东西上传到本地仓库给你本地自己用,或上传到远程仓库,供大家使用。
远程仓库可以在工程的pom.xml文件里指定,楼上两位已经列的很清楚了。如果没指定,默认就会把下面这地方做远程仓库,即默认会到http://repo1.maven.org/maven2这个地方去请求插件和依赖包。 <repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository> mirror就是镜像,主要提供一个方便地切换远程仓库地址的途径。比如,上班的时候在公司,用电信的网络,连的是电信的仓库。回到家后,是网通的网络,我想连网通的仓库,就可以通过mirror配置,统一把我工程里的仓库地址都改成联通的,而不用到具体工程配置文件里一个一个地改地址。
4、 ecplise中maven配置
相关文章推荐
- 『搭建中小型互联网公司后台服务架构』三、后台服务数据库工具mysql安装
- 『搭建中小型互联网公司后台服务架构』四、后台服务nosql数据库mongodb:高可用讲解以及安装
- 『搭建中小型互联网公司后台服务架构』一、简介
- 架构实战项目心得(九):后台服务工具ldap:统一用户中心ldap工具使用以及安装
- centos DNS服务搭建 DNS原理 使用bind搭建DNS服务器 配置DNS转发 配置主从 安装dig工具 DHCP dhclient 各种域名解析记录 mydns 第三十节课
- 教你如何快速为企业公司搭建sendmail邮件服务;以及安装配置OpenWebmail的安装、测
- Nginx安装配置与服务搭建
- Spring flex 搭建服务 之 架构原理(BlazeDS)和服务配置方法 (第一章)
- Django 后台美化工具django-grappelli安装及配置
- 互联网公司高并发图片存储服务架构设计一
- Linux安装配置maven以及搭建nexus私服(编写启动脚本)
- 互联网公司高并发图片(缩略图)处理中间层服务架构设计一
- Maven3 安装使用(三)--搭建公司局域网maven服务器
- 在浙江杭州快速开发公司内部办公自动化OA系统的经验总结(有成熟的后台配置工具、开发平台、程序员朋友圈还真不错,做软件项目还得靠积累才稳妥)