Nexus私服的搭建原理及教程解析

2025-05-27 0 80

一.为什么要构建Nexus私服

公司所有开发成员没有外网,通过局域网连接 nexus 私服,由私服连接外网。

把项目发布到私服.其他人员从私服下载。

二.使用私服之后架构图

Nexus私服的搭建原理及教程解析

三.搭建 Nexus

3.1 nexus-2.10-1bundle.zip 解压到任意非中文目录中

3.2进入 nexus-2.10-1\\bin\\jsw\\indows-x86-4(对应自己系统)

Nexus私服的搭建原理及教程解析

以windows64系统为例

Nexus私服的搭建原理及教程解析

instal-nexus.bat 安装服务
star-nexus.bat 开启服务
stop-nexus.bat 停止服务
unistal-nexus.bat 卸载服务

3.3 登录后台

在浏览器输入 htp:/localhost:8081/nexus

默认端口8081
默认用户名admin
默认密码admin123

若需调整可配置nexus-2.10-1\\conf\\exus.proerties

Nexus私服的搭建原理及教程解析

四.使用 maven 连接私服

4.1修改maven 的 setings.xml

<?xml version="1.0" encoding="UTF-8"?>

	<settings>

	<localRepository>G:\\tool\\m2\\myrepository</localRepository>

	<mirrors>

<mirror>

	<id>nexus-releases</id>

	<mirrorOf>*</mirrorOf>

	<url>http://localhost:8081/nexus/content/groups/public</url>

	</mirror>

	<mirror>

	<id>nexus-snapshots</id>

	<mirrorOf>*</mirrorOf>

	<url>http://localhost:8081/nexus/content/repositories/apache-snapshots/

	</url>

	</mirror>

	</mirrors>

<profiles>

	<profile>

	<id>jdk-1.7</id>

	<activation>

	<activeByDefault>true</activeByDefault>

	<jdk>1.7</jdk>

	</activation>

	<properties>

	<maven.compiler.source>1.7</maven.compiler.source>

	<maven.compiler.target>1.7</maven.compiler.target>

	<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>

	</properties>

	</profile>

<profile>

	<id>nexusTest</id>

	<repositories>

	<repository>

	<id>local-nexus</id>

	<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>

	<releases>

	<enabled>true</enabled>

	</releases>

	<snapshots>

	<enabled>true</enabled>

	</snapshots>

	</repository>

	</repositories>

	</profile>

</profiles>

<activeProfiles> <!--激活 id为 nexusTest的 profile -->

	<activeProfile>nexusTest</activeProfile>

	</activeProfiles>

	<servers>

	<server>

	<id>releases</id>

	<username>admin</username>

	<password>admin123</password>

	</server>

	<server>

	<id>snapshots</id>

	<username>admin</username>

	<password>admin123</password>

	</server>

	</servers>

	</settings>

G:\\tool\\m2\\myrepository 存放本地仓库位置

http://127.0.0.1:8081 Nexus服务器ip及端口

admin/ admin123 Nexus服务器登录用户名和密码

五.把项目发布到私服的步骤

5.1 pom.xml 中配置私服路径

<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/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<groupId>com.bjsxt</groupId>

	<artifactId>test</artifactId>

	<version>0.0.1-SNAPSHOT</version>

<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>

</project>

5.2 在 setings.xml 中配置连接私服仓库的用户名和密码

<servers>

	<server>

	<id>releases</id>

	<username>admin</username>

	<password>admin123</password>

	</server>

	<server>

	<id>snapshots</id>

	<username>admin</username>

	<password>admin123</password>

	</server>

	</servers>

5.3 右键项目-> run as 输入 deploy

添加到项目后,后台可查询到对应包

Nexus私服的搭建原理及教程解析

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持快网idc。

原文链接:https://www.cnblogs.com/hzcjd/p/12347172.html

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 行业资讯 Nexus私服的搭建原理及教程解析 https://www.kuaiidc.com/68851.html

相关文章

猜你喜欢
发表评论
暂无评论