將下面的配置粘貼複製到settings.xml
請先配置Maven的環境變量!!!!
<?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">
<!--本地Maven倉庫服務 :SSH相關配置-->
<!-- <localRepository>C:\repository</localRepository>-->
<!--本地Maven倉庫服務 :SSM相關配置-->
<!-- <localRepository>C:\.m2\repository</localRepository>-->
<!--當前使用:如果使用遠程倉庫1.不需要指定倉庫默認User\用戶名\.m2\repository,2.可以指定本地倉庫下載位置 -->
<localRepository>D:\ALocal\Maven_Jars</localRepository>
<pluginGroups></pluginGroups>
<proxies></proxies>
<!--配置參考:
http://www.sojson.com/blog/168.html | Maven基礎
http://blog.csdn.net/haohaizijhz/article/details/72841489 | Maven配置多倉庫鏡像
http://blog.csdn.net/caomiao2006/article/details/40401517 | mirror和repository 區別
http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/maven-skill-introduce.html
| IntelliJ IDEA 配合 Maven 的一些技巧
-->
<!--阿里雲中央Maven雲服務-->
<mirrors>
<mirror>
<!--id, name是該鏡像的唯一定義符。id用來區分不同的mirror元素。 -->
<id>aliyun</id>
<name>aliyun maven</name>
<!--url是該鏡像的URL。構建系統會優先考慮使用該URL,而非使用默認的服務器URL。 -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<!--<mirrorOf>的值爲星號,表示該配置是匹配所有遠程倉庫。 -->
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<!--如果該鏡像倉庫需要認證,則配置setting.xml中的<server></server>即可。-->
<servers></servers>
<profiles>
<!--1.下載源碼的配置-->
<profile>
<id>aliyun</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
<!--1.下載源碼的配置-->
<profile>
<!--阿里雲中央倉庫-->
<profile>
<id>aliyun</id>
<repositories>
<repository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--阿里雲中央倉庫-->
<!--當前使用的遠程倉庫名稱-->
<activeProfiles>
<activeProfile>aliyun</activeProfile>
</activeProfiles>
<!--當前使用的遠程倉庫名稱-->
</settings>
Eclipse Maven 配置
在Windiw的配置搜索欄選擇Maven點User Settings 視圖配置Settings.xml文件目錄,默認下載插件的位置在.m2
配置選擇框 Golbal Settings 選中conf\Settings.xml文件
完成後點擊Apply保存操作;
配置Maven視圖:(顯示Maven倉庫的目錄,這個視圖可以找到有木有這個jar,)
Window==》show View ==》Maven Repository==》保存==》到多視圖欄,找到Maven Repository,右點Local Repository ==》Rebuild Index(重建索引)==>提示框OK
上傳Jar包至私服命令:
請先查看具體步驟!!!
# DgroupId、DartifactId、Dversion——表示的是Maven 構建的基本座標,你需要根據你上次的jar包自行改變
deploy:deploy-file # Maven dependency 座標
-DgroupId=com.lowagie # Maven 的 groupId座標
-DartifactId=iTextAsian # Maven 的 artifactId座標
-Dversion=2.0.7 # Maven 的 version座標
-Dpackaging=jar # Dpackaging——表示的是上傳的包的類型,一般爲jar,不用改變,根據你的實際情況來改變。
-Dfile=E:\iTextAsian-2.0.7.jar # 表示的是上傳的包的類型,一般爲jar,不用改變,根據你的實際情況來改變。
-Durl=http://192.168.0.16:8080/repository/3rd-party/ # 表示的是你要上傳到的私有倉庫的地址
-DrepositoryId=3rd-party # 表示的你的Maven用戶ID(Settings.xml中配置)
-X # Debug Maven運行日誌
這裏來對這些參數進行說明:
- DgroupId、DartifactId、Dversion——表示的是構建的基本座標,你需要根據你上次的jar包自行改變
- Dpackaging——表示的是上傳的包的類型,一般爲jar,不用改變,根據你的實際情況來改變。
- Dfile——表示的是你需要上傳的包的地址
- Durl——表示的是你要上傳到的私有倉庫的地址
- DrepositoryId——表示你的身份信息,可以從第二步獲取。