官方文档
https://help.sonatype.com/repomanager3/installation/run-as-a-service
下载、解压
在…/nexus-3.14.0-04-win64/nexus-3.14.0-04/bin 目录下,以管理员身份运行cmd
安装启动本地服务
安装nexus本地服务,启动nexus本地服务
nexus.exe /install nexus3 # 安装 nexus3 服务
sc delete nexus3 # 删除nexus3服务
nexus.exe /start nexus3 # 启动nexus3服务
nexus.exe /stop nexus3 # 停止nexus3服务
备注:nexus3 是服务名,可以随便取名字的。也就是windows系统中本地服务内的服务名称
参考文档
https://www.cnblogs.com/hujunzheng/p/9807646.html
https://www.cnblogs.com/sxdcgaq8080/p/7580964.html
https://www.cnblogs.com/happyday56/p/11714802.html
https://www.cnblogs.com/my-king/p/6405421.html
https://www.cnblogs.com/yuxiaole/p/9771613.html
更新索引
https://blog.csdn.net/lusyoe/article/details/52821088
Maven settings.xml 配置
搭建 nexus3 私服的 settings.xml 设置
<?xml version="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">
<!--<localRepository>C:\Users\Administrator\.m2\repository</localRepository>-->
<localRepository>D:\Program Files\apache-maven-3.6.0\repo</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
</pluginGroups>
<!--配置权限,使用默认用户-->
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!-- 私服镜像 -->
<mirrors>
<mirror>
<id>maven-public</id> <!-- 私服 nexus3 的 public 仓库的Name -->
<name>maven-public</name> <!-- 私服 nexus3 的 public 仓库的Name -->
<mirrorOf>*</mirrorOf> <!-- 之前写的是中央仓库 Url 。* 号代表所有 -->
<url>http://localhost:8181/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
不搭建私服的 settings.xml 配置
<?xml version="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">
<!--<localRepository>C:\Users\Administrator\.m2\repository</localRepository>-->
<localRepository>D:\Program Files\apache-maven-3.6.0\repo</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
</pluginGroups>
<!--配置权限,使用默认用户-->
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!-- 私服镜像 -->
<mirrors>
<mirror>
<id>nexus-aliyun</id> <!-- 私服的仓库 Group ID -->
<name>Nexus aliyun</name>
<mirrorOf>central</mirrorOf> <!-- 之前写的是中央仓库 Url 。* 号代表所有 -->
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
nexus3 启动仓库
nexus3 是右边表示可用的仓库,nexus2 是左边表示可用的仓库