Nexus私服的搭建原理及教程解析
一.為什么要構(gòu)建Nexus私服?
公司所有開(kāi)發(fā)成員沒(méi)有外網(wǎng),通過(guò)局域網(wǎng)連接 nexus 私服,由私服連接外網(wǎng)。
把項(xiàng)目發(fā)布到私服.其他人員從私服下載。
二.使用私服之后架構(gòu)圖
三.搭建 Nexus
3.1 nexus-2.10-1bundle.zip 解壓到任意非中文目錄中
3.2進(jìn)入 nexus-2.10-1\bin\jsw\indows-x86-4(對(duì)應(yīng)自己系統(tǒng))
以windows64系統(tǒng)為例
- instal-nexus.bat 安裝服務(wù)
- star-nexus.bat 開(kāi)啟服務(wù)
- stop-nexus.bat 停止服務(wù)
- unistal-nexus.bat 卸載服務(wù)
3.3 登錄后臺(tái)
在瀏覽器輸入 htp:/localhost:8081/nexus
默認(rèn)端口8081
默認(rèn)用戶(hù)名admin
默認(rèn)密碼admin123
若需調(diào)整可配置nexus-2.10-1\conf\exus.proerties
四.使用 maven 連接私服
4.1修改maven 的 setings.xml
<?xml version="1.0" encoding="UTF-8"?> <settings> <localRepository>G:\tool\m2\myrepository</localRepository> <mirrors> <mirror> <id>nexus-releases</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public</url> </mirror> <mirror> <id>nexus-snapshots</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/repositories/apache-snapshots/ </url> </mirror> </mirrors> <profiles> <profile> <id>jdk-1.7</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties> </profile> <profile> <id>nexusTest</id> <repositories> <repository> <id>local-nexus</id> <url>http://127.0.0.1:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <!--激活 id為 nexusTest的 profile --> <activeProfile>nexusTest</activeProfile> </activeProfiles> <servers> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers> </settings>
G:\tool\m2\myrepository 存放本地倉(cāng)庫(kù)位置
http://127.0.0.1:8081 Nexus服務(wù)器ip及端口
admin/ admin123 Nexus服務(wù)器登錄用戶(hù)名和密碼
五.把項(xiàng)目發(fā)布到私服的步驟
5.1 pom.xml 中配置私服路徑
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.bjsxt</groupId> <artifactId>test</artifactId> <version>0.0.1-SNAPSHOT</version> <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> </project>
5.2 在 setings.xml 中配置連接私服倉(cāng)庫(kù)的用戶(hù)名和密碼
<servers> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers>
5.3 右鍵項(xiàng)目-> run as 輸入 deploy
添加到項(xiàng)目后,后臺(tái)可查詢(xún)到對(duì)應(yīng)包
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。