当前位置:网站首页>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)
边栏推荐
- Add vector formula in rich text editor (MathType for TinyMCE, visual addition)
- Kityformula editor configure font size and spacing
- Thoroughly master prototype__ proto__、 Relationship before constructor (JS prototype, prototype chain)
- Large top heap, small top heap and heap sequencing
- 【题解】Educational Codeforces Round 82
- mathML转latex
- Base64 编码原来还可以这么理解
- YoloV6训练:训练自己数据集遇到的各种问题
- Obsidian installs third-party plug-ins - unable to load plug-ins
- Introduction to C language -- array
猜你喜欢

How does CTO help the business?

一张图彻底掌握prototype、__proto__、constructor之前的关系(JS原型、原型链)
![[untitled] leetcode 2321 Maximum score of concatenated array](/img/a3/54d0e83f02ef0d0d8d269351c35b39.png)
[untitled] leetcode 2321 Maximum score of concatenated array

fatal: unsafe repository is owned by someone else 的解决方法

STM32 library function for GPIO initialization

btrace-(字节码)动态跟踪工具

编译原理课程实践——实现一个初等函数运算语言的解释器或编译器

mathML转latex

C code audit practice + pre knowledge

Ad20 cannot select the solution of component packaging in PCB editor
随机推荐
富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)
C thread transfer parameters
华为面试题: 没有回文串
C#延时、在线程中开启定时器、获取系统时间
记一次报错解决经历依赖重复
Jenkins Pipeline 应用与实践
[Space & single cellomics] phase 1: single cell binding space transcriptome research PDAC tumor microenvironment
Ad20 cannot select the solution of component packaging in PCB editor
Advanced C language (realize simple address book)
STM32 standard firmware library function name (I)
C code audit practice + pre knowledge
Advanced C language (learn malloc & calloc & realloc & free in simple dynamic memory management)
Error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.
[QNX Hypervisor 2.2用户手册]6.3 Guest与外部之间通信
Yolov6 training: various problems encountered in training your dataset
About text selection in web pages and counting the length of selected text
Btrace- (bytecode) dynamic tracking tool
实现一个多进程并发的服务器
C # delay, start the timer in the thread, and obtain the system time
4. Array pointer and pointer array