博主这里使用的是阿里云Centos7服务器。
博主环境如下:
jdk11、Centos7、nexus-3.16.1-02-unix
这里就直接过了。这个过于简单
博主这里疯狂拒绝连接,so,博主下载到本地,scp上去了
wget http://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz
tar zxvf nexus-3.16.1-02-unix.tar.gz
sudo vi /etc/profile
source /etc/profile
export MAVEN_HOME=/home/codemperor/nexus-3.16.1-02
export PATH=$MAVEN_HOME:$PATH
如果端口冲突,可以进入MAVEN_HOME/etc/nexus-default.properties 修改
进入maven的bin下面
./nexus start
如果报错:Detected execution as “root” user. This is NOT recommended!, 记得换用户哦:
useradd nexus
chown -R nexus:nexus /usr/local/nexus
su nexus
在这个用户下执行启动即可
http://ip:8081 博主因为是内网搭建,所以用了负载均衡,不过还是8081啦
//启动
nexus start
//停止
nexus stop
//重启
nexus restart
//查看状态
nexus status
官网:https://support.sonatype.com/hc/en-us/articles/213467158-How-to-reset-a-forgotten-admin-password-in-Nexus-3-x
我们修改一下admin密码,然后我们创建一个其他的user,方便做权限管理
第一步:进入OrientDB控制台
linux: java -jar ./lib/support/nexus-orient-console.jar
win: java -jar lib\support\nexus-orient-console.jar
mac: .install4j/jre.bundle/Contents/Home/jre/bin/java -jar ./lib/support/nexus-orient-console.jar
第二步:进入数据库
connect plocal:/home/nexus/sonatype-work/nexus3/db/security admin admin
第三步:重置密码
update user SET password="这里是你要修改的密码" UPSERT WHERE id="admin"
将你的项目打成可执行jar,在pom中加入:
${project.artifactId}
org.apache.maven.plugins
maven-compiler-plugin
2.5.1
1.8
1.8
true
maven-assembly-plugin
3.1.0
upload.Boot
jar-with-dependencies
make-assembly
package
single
然后执行
mvn clean package -DskipTests
打出来有两个jar,我们使用with-dependencies 这个是把附带的所有第三方jar全部打进去了
确定即可
在pom中加入
nexus
maven-public
http://maven地址/repository/maven-public/
true
true
引入你刚才上传的jar的pom就ok啦
首先,我们在需要达成jar的pom中加入:
releases
releases Repository
http://x.x.x.x/repository/maven-releases/
snapshots
snapshots
http://x.x.x.x/repository/maven-snapshots/
然后在你的settings.xml中的中加入:
releases
账
密码
snapshots
账号
密码
然后执行mvn deploy
搞定收工~
推荐一些文章:
https://www.cnblogs.com/2YSP/p/9533506.html
https://blog.csdn.net/u013887008/article/details/79429973
https://www.cnblogs.com/sxdcgaq8080/p/7583767.html
打包:https://www.cnblogs.com/sxdcgaq8080/p/8399854.html