当前位置:网站首页>Mavn 搭建 Nexus 私服
Mavn 搭建 Nexus 私服
2022-07-02 11:56:00 【云计算-Security】
一、目的
有时候 Java 开发在构建项目的时候,由于存在一些依赖关系会把整体项目都进行构建,这样一来 Jenkins 构建就非常慢,四五分钟才能构建完成。于是可以搭建 Mavn 私服 Nexus,开发将公用的 jar 包先上传到 Nexus,这样在构建的时候不需要额外的构建,从而提高 Jenkins 构建性能。
二、部署
1、下载
Nexus 版本:3.x
Nexus 安装包下载链接:https://help.sonatype.com/repomanager3/product-information/download

2、解压
[[email protected] ~]# tar xzf nexus-3.39.0-01-unix.tar.gz
3、配置
配置 JDK 路径:
[[email protected] ~]# cd nexus-3.39.0-01/bin/
[[email protected] bin]# cat nexus
...
# Uncomment the following line to override the JVM search sequence
# INSTALL4J_JAVA_HOME_OVERRIDE=
# Uncomment the following line to add additional VM parameters
# INSTALL4J_ADD_VM_PARAMS=
INSTALL4J_JAVA_HOME_OVERRIDE=/opt/jdk
...
修改 JVM 堆大小(默认为 2703M):根据实际情况修改
[[email protected] ~]# cd nexus-3.39.0-01/bin/
[[email protected] bin]# cat nexus.vmoptions
...
-Xms512m
-Xmx512m
...
修改默认端口(默认为 8081):
[[email protected] ~]# cd nexus-3.39.0-01/etc/
[[email protected] etc]# cat nexus-default.properties
...
application-port=8181
application-host=0.0.0.0
...
4、启动
[[email protected] ~]# cd nexus-3.39.0-01/bin/
# 此启动为后台启动
[[email protected] bin]# ./nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
Starting nexus
# 停止
# [[email protected] bin]# ./nexus stop
# 重启
# [[email protected] bin]# ./nexus restart
# 前台启动(打印日志)
# [[email protected] bin]# ./nexus run
5、访问
http://139.198.105.50:8181/

点击右上角 Sign in 登录
用户名:admin
密码:find 找一下(一般与 Nexus 的解压文件处于同一级目录下)
[[email protected] bin]# find / -name "admin.password" /root/sonatype-work/nexus3/admin.password [[email protected] ~]# cd /root/sonatype-work/nexus3/ [[email protected] nexus3]# cat admin.password 4649fc72-d96b-44a5-93eb-e7101db22072
输入初始密码后会提示你设置新密码:

最后进入web页面:

至此,Nexus 安装完成!!后续就是一些点点点的操作。
三、FAQ
1、JDK 版本问题
# 当前版本11.X
[[email protected] opt]# java -version
java version "11.0.2" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
# 启动报错(说JDK版本必须是1.8.X)
[email protected] bin]# ./nexus start
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
2、解决方案
降低 JDK 版本为 1.8.X 即可解决该问题。
[[email protected] opt]# wget https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/8/jdk/x64/linux/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz
[[email protected] opt]# tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz
# 将原来JDK家目录mv备份
[[email protected] opt]# mv /opt/jdk /opt/jdk.bak
# 经1.8.X版本mv改名为JDK即可
[[email protected] opt]# mv jdk8u322-b06/ jdk
# 再看看当前JDK版本(已经降下来了)
[[email protected] opt]# java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (Temurin)(build 25.322-b06, mixed mode)
边栏推荐
- 871. 最低加油次数 : 简单优先队列(堆)贪心题
- 牛客练习赛101
- C语言习题---(数组)
- 天猫商品详情接口(APP,H5端)
- Actual combat sharing of shutter screen acquisition
- Li Chuang EDA learning notes 15: draw border or import border (DXF file)
- STM32 standard firmware library function name memory (II)
- LeetCode 209. Minimum length subarray
- Bit by bit of OpenCV calling USB camera
- 【NOI模拟赛】伊莉斯elis(贪心,模拟)
猜你喜欢
随机推荐
C#延时、在线程中开启定时器、获取系统时间
qml 弹窗框架,可定制
JMeter script parameterization
Dragonfly low code security tool platform development path
Error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.
Xilinx Vivado set *.svh as SystemVerilog Header
IE 浏览器正式退休
buuctf-pwn write-ups (7)
taobao. trade. Get (get some information of a single transaction), Taobao store order interface, Taobao oauth2.0 interface, Taobao R2 interface code docking and sharing
编译原理课程实践——实现一个初等函数运算语言的解释器或编译器
tmall. product. schema. Get (product information acquisition schema acquisition), Taobao store upload commodity API interface, Taobao commodity publishing interface, Taobao commodity upload API interf
C language exercises - (array)
OpenCV调用USB摄像头的点滴
Bit by bit of OpenCV calling USB camera
C thread transfer parameters
MFC CString to char*
一张图彻底掌握prototype、__proto__、constructor之前的关系(JS原型、原型链)
表格响应式布局小技巧
Tmall product details interface (APP, H5 end)
数据库连接池和数据源








