maven 私服的使用及settings.xml的配置
生活随笔
收集整理的這篇文章主要介紹了
maven 私服的使用及settings.xml的配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
settings中的配置
1、映射阿里中央倉庫(下載jar包快一點)
<mirrors><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf> </mirror> </mirrors>2、配置本地倉庫(無需聯網使用jar包)
<localRepository>E:\maven_repository</localRepository>3、登錄私服:
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server>4、在客戶端的 setting.xml 中配置私服的倉庫(用于本地項目依賴私服項目)
<profile> <!--profile 的 id--> <id>dev</id> <repositories> <repository> <!--倉庫 id,repositories 可以配置多個倉庫,保證 id 不重復--> <id>nexus</id> <!--倉庫地址,即 nexus 倉庫組的地址--> <url>http://localhost:8081/nexus/content/groups/public/</url> <!--是否下載 releases 構件--> <releases> <enabled>true</enabled> </releases> <!--是否下載 snapshots 構件--> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <!-- 插件倉庫,maven 的運行依賴插件,也需要從私服下載插件 --> <pluginRepository> <!-- 插件倉庫的 id 不允許重復,如果重復后邊配置會覆蓋前邊 --> <id>public</id> <name>Public Repositories</name> <url>http://localhost:8081/nexus/content/groups/public/</url> </pluginRepository> </pluginRepositories> </profile>5、激活倉庫
<activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>pom.xml配置(用于上傳項目到私服上)
<distributionManagement> <repository> <id>releases</id> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>私服的安裝NEXUS【了解】
一般公司早就有私服了。
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的maven 私服的使用及settings.xml的配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日志信息jar包 slf4j-api、
- 下一篇: java错误: 非法字符: '\ufef