Nexus Repository Manager OSS 3.x 安装
- 下载
https://www.sonatype.com/download-oss-sonatype 选择对应的版本下载,以nexus-3.6.0-02-win64(https://www.sonatype.com/oss-thank-you-win64.zip)为例;
- 解压
将nexus-3.6.0-02-win64.zip解压至对应目录;
- 执行
...\nexus-3.6.0-02-win64\nexus-3.6.0-02\bin>nexus.exe /run
- 修改配置
配置文件位于:\etc\nexus-default.properties
- application-port=8091 内嵌Jetty对应Web服务端口号;
- application-host=0.0.0.0 对应Host;
- nexus-context-path=/nexus
- 注册服务(Windows Platform)
...\nexus-3.6.0-02-win64\nexus-3.6.0-02\bin>nexus.exe /install nexus
- Nexus Repository Manager 管理页面
URL:http://localhost:8091/nexus;
点击右上角Sign in 按钮登录。默认用户名:admin,密码:admin123;
点击齿轮状配置按钮,进入配置页面;
- Nexus、Maven结合使用,建立本地私库
- 修改Maven全局或者本地settings.xml;
- 或者直接配置在项目的POM文件中;
上述两种方式均可;
settings.xml增加如下配置:
<localRepository>D:\...\repository-dev</localRepository>
<mirror>
<id>nexus-public</id>
<mirrorOf>central</mirrorOf>
<name>Nexus Repository</name>
<url>http://<Host>:8091/nexus/repository/maven-public/</url>
</mirror>
<server>
<id>nexus-releases</id>
<username>dev</username>
<password>123456</password>
</server>
<server>
<id>nexus-snapshot</id>
<username>dev</username>
<password>123456</password>
</server>
POM 文件修改实例:
<repositories> <repository> <id>nexus-public</id> <name>nexus-public</name> <url>http://<Host>:8091/nexus/repository/maven-public/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> </repositories> <distributionManagement> <repository> <id>nexus-nexus</id> <name>Releases</name> <url>http://<Host>:8091/nexus/repository/maven-releases/</url> </repository> <snapshotRepository> <id>nexus-nexus</id> <name>Snapshot</name> <url>http://<Host>:8091/nexus/repository/maven-snapshots/</url> </snapshotRepository> </distributionManagement>
-------------------------------------------------------------------------------------------------------------
本地私库即可从远程仓库下载资源了: