maven手动导入jar包到本地仓库-良心之作
1、1. 测试maven
1.1 命令行输入mvn -v,如果提示如下图则表示能使用maven命令,提前安装好jdk否则会报错。
1.2 浏览器输入https://pan.baidu.com/s/1kVBZ5fL即可下载maven安装包。
1.3 安装完maven后在系统变量中新建MAVEN_HOME,值输入E:\StsWorkSpace\smartMaven\apache-maven-3.2.5
1.4 path变量输入;%MAVEN_HOME%\bin;



2、2. 下载jar包
2.1 输入mvnrepository网站地址-->找到jar包位置下载即可。
2.2 找到本地下载的jar包。


3、3. 输入mvn命令
3.1 输入mvn install:install-file -Dfile=C:\Users\sinosoft\Desktop\lib\spring-cloud-sleuth-zipkin-1.2.0.RC1.jar -DgroupId=org.springframework.cloud -DartifactId=spring-cloud-sleuth-zipkin -Dversion=1.2.0.RC1 -Dpackaging=jar-->提示build Success即可。
命令解释:mvn install:install-file -Dfile=本地jar包路径 -DgroupId=可查看groupID -DartifactId=查看artifactId -Dversion=查看version -Dpackaging=jar


4、4. 检查setting.xml文件
4.1 找到maven库conf文件夹下的setting.xml文件。
4.2 下面是简化的setting.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>E:\StsWorkSpace\smartMaven\repository</localRepository>
<mirrors>
<mirror>
<id>mvn</id>
<mirrorOf>mvnrepository</mirrorOf>
<url>http://mvnrepository.com/</url>
</mirror>
</mirrors>
</settings>

5、4. 测试本地库
4.1 找到本地maven库-->搜索spring-cloud-starter-sleuth找到文件夹并查看有jar即可。
4.2 右击项目-->maven-->update Project。
4.3 勾选office和Force Update。。。按钮-->OK即可。
提醒:本地maven库地址在setting.xml文件中的localRepository属性中定义。


