下载地址
http://sonatype.com/repomanager3/download下载完成后进行解压,执行下列步骤,安装并启动nexus
1. 安装
nexus /install Nexus_Repo_Manager

2. 启动
nexus /start Nexus_Repo_Manager

默认启动后再localhost:8081端口部署

3. 登录
用户名为admin,密码根据提示找到

登陆成功后进行密码修改。
4. 在项目中配置distributionManager
- <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/maven-v4_0_0.xsd">
- <dependencies>
- dependencies>
-
- <distributionManagement>
- <repository>
- <id>nexusReleasesid>
- <name>Releasesname>
- <url>http://localhost:8081/repository/maven-releases url>
- repository>
-
- <snapshotRepository>
- <id>nexusSnapshotsid>
- <name>Snapshotsname>
- <url>http://localhost:8081/repository/maven-snapshotsurl>
- snapshotRepository>
- distributionManagement>
-
- <build>
-
- build>
- project>
这里配置了一个默认的release版本的仓库,一个是开发版本的仓库,id是唯一的标识,url是仓库的地址。
5. 在setting.xml中配置登录信息
- "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">
- <servers>
- <server>
- <id>nexusReleasesid>
- <username>adminusername>
- <password>admin123password>
- server>
- <server>
- <id>nexusSnapshotsid>
- <username>adminusername>
- <password>admin123password>
- server>
- servers>
- settings>
在servers配置中,配置相关的登录信息,注意id是和项目中的一致。
6. 在项目中发布,即可发布jar包
mvn deploy
