在windows平台上,使用idea配置maven项目,发布到远程仓库nexus

1,下载nexus,https://pan.baidu.com/s/1oTIsBBIu30GC4Tg5KLUwlg

2,解压到没有空白符号和中文字符的路径中。

3,使用管理员权限运行cmd,打开你解压出来的文件,并找到 nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin 这个目录。

4,使用cmd,打开上面的bin文件夹,运行 ./nexus.bat install。

5,打开windows的服务列表。右键刷新。可看到nexus服务已经安装。右键它,进行启动。在windows平台上,使用idea配置maven项目,发布到远程仓库nexus

6,打开浏览器,输入http://localhost:8081/nexus

7,在windows平台上,使用idea配置maven项目,发布到远程仓库nexus右上角可进行登陆,账号密码为 admin 和  admin123

8,使用idea新建一个springboot的项目,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>

9,ctrl+shift+n 找到settings.xml,如箭头所指。

在windows平台上,使用idea配置maven项目,发布到远程仓库nexus

10,在<servers>标签中添加

<server>
  <id>releases</id>
  <username>admin</username>
  <password>admin123</password>
</server>
<server>
  <id>snapshots</id>
  <username>admin</username>
  <password>admin123</password>
</server>

11,入下图,点击deploy发布,即可。注意你的必须在pom.xml中指定你项目的版本号,并且是*-SNAPSHOT这样的格式。

在windows平台上,使用idea配置maven项目,发布到远程仓库nexus

12,入下图所示,已经上传成功。

在windows平台上,使用idea配置maven项目,发布到远程仓库nexus