1.下載nexusbash
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz
2.解壓,會出現兩個目錄,nexus-2.11.2-03是服務 sonatype-work是私有庫目錄app
mkdir nexus tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C ./nexus
3.修改配置,在nexus-2.11.2-03/bin目錄下修改nexus文件maven
NEXUS_HOME=「安裝目錄」 RUN_AS_USER=xxx
4.修改端口,nexus-2.11.2-03/conf修改nexus.properties文件url
application-port=XXX
5.啓動.net
./bin/nexus start Starting Nexus OSS... Started Nexus OSS.
6.修改密碼server
admin:該用戶擁有Nexus的所有權限,默認密碼爲admin123。 deployment:該用戶可以訪問Nexus,瀏覽倉庫內容、搜索、上傳部署構件,可是不能對Nexus進行任何配置,默認密碼爲deployment123。 anonymous:該用戶對應了全部未登陸的匿名用戶,它們能夠瀏覽倉庫並進行搜索。
7.上傳Jar包xml
參考:上傳jar包到nexus私服blog
登陸以後能夠看到以下倉庫ssl
<1>若是上傳的是第三方的jar包部署
在圖中填入相應的jar包的信息就能夠了
同時在maven的setting.xml文件中配置
<servers> <server> <id>nexus-releases</id> <username>admin</username> <password>xxxx</password> </server> <server> <id>nexus-snapshots</id> <username>admin</username> <password>xxxx</password> </server> </servers>
以及
<mirror> <id>mynexus</id> <mirrorOf>central</mirrorOf> <name>My Nexus</name> <url>http://XXX/nexus/content/repositories/thirdparty/</url> </mirror>
<2>上傳snapshot包
在工程的pom文件中配置
<distributionManagement> <repository> <id>nexus-releases</id> <name>Nexus Release Repository</name> <url>http://XXX/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://XXX/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
同時在maven的setting.xml文件中配置
</profiles> <profile> <id>nexus</id> <repositories> <repository> <id>nexus-releases</id> <url>http://nexus-releases</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>nexus-snapshots</id> <url>http://nexus-snapshots</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus-releases</id> <url>http://nexus-releases</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> <pluginRepository> <id>nexus-snapshots</id> <url>http://nexus-snapshots</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles>
而後在項目下運行,就會生成snapshot包
mvn deploy