nexus界面
首次安装nexus,默认账户密码是admin admin123
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/4d192bb1924ab5629040548821c50029.png)
在项目中使用 Maven 私服
公司为了安全,只提供依赖,不提供源码,需要将其放入私服中。
maven settings.xml servers节点下增加配置
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
pom下添加
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.79.130:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.79.130:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
id 为server里配置的id,url在仓库中
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/ac2025e9fd1a16dd4a1e7564e73dab82.png)
mvn deploy 上传
从私服下载jar
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>//192.168.79.130:8081/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Plugin Repository</name>
<url>http://192.168.79.130:8081/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>