当前位置:网站首页>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)
边栏推荐
猜你喜欢
表格响应式布局小技巧
Obsidian installs third-party plug-ins - unable to load plug-ins
解决el-radio-group 回显后不能编辑问题
一张图彻底掌握prototype、__proto__、constructor之前的关系(JS原型、原型链)
C code audit practice + pre knowledge
Btrace- (bytecode) dynamic tracking tool
【C语音】详解指针进阶和注意点(2)
buuctf-pwn write-ups (7)
MFC 定时器使用
Simple verification code generator for 51 single chip microcomputer experiment
随机推荐
【空间&单细胞组学】第1期:单细胞结合空间转录组研究PDAC肿瘤微环境
富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)
2. Const pointer
LeetCode_字符串_简单_412.Fizz Buzz
fatal: unsafe repository is owned by someone else 的解决方法
Introduction to mathjax (web display of mathematical formulas, vector)
qml 弹窗框架,可定制
Large top heap, small top heap and heap sequencing
JMeter script parameterization
YoloV6训练:训练自己数据集遇到的各种问题
btrace-(字节码)动态跟踪工具
Tmall product details interface (APP, H5 end)
为什么只会编程的程序员无法成为优秀的开发者?
C#代码审计实战+前置知识
【NOI模拟赛】刮痧(动态规划)
threejs的控制器 立方體空間 基本控制器+慣性控制+飛行控制
Actual combat sharing of shutter screen acquisition
Makefile separates file names and suffixes
1. Editing weapon VIM
Slashgear shares 2021 life changing technology products, which are somewhat unexpected