javaWeb之路

centos7 搭建私人maven仓库

2017-05-18  本文已影响0人  oo_pp
安装jdk
#yum install java
#jave -version

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
安装maven
#yum install maven
#mvn -version

Apache Maven 3.0.5 (Red Hat 3.0.5-17)
Maven home: /usr/share/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7_3.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-327.22.2.el7.x86_64", arch: "amd64", family: "unix"
安装nexus:我是安装在挂载盘符 /mnt上
------切换到下载目录
#cd /mnt
------下载压缩包
#wget  https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.12.0-01-bundle.tar.gz
------解压
#tar -zvxf nexus-2.12.0-01-bundle.tar.gz
------重命名nexus文件夹
# mv nexus-2.12.0-01 nexus
安装nexus到系统服务
------复制脚本到/etc/init.d
#sudo cp nexus/bin/nexus /etc/init.d/nexus
------编辑刚刚复制过去的脚本:我用root用户启动,但官方不推荐
#vi /etc/init.d/nexus
------修改:NEXUS_HOME="/mnt/nexus";RUN_AS_USER=root
------添加系统服务
#chkconfig --add nexus
#chkconfig --levels 345 nexus on
------启动nexus
#service nexus start

修改nexus默认用户名密码
仓库配置说明:
image.png

borwse index面板,可以查看当前组包含的库(proxy代理仓库,要配置才能在这显示)

image.png image.png image.png
包搜索使用
image.png
本地maven仓库配置,修改本地maven配置文件仓库地址,使用public组

配置文件位置,可以通过myeclipse>preferences>MyEclipse>MavenMyEclipse>User Setting>open file直接编辑

<mirrors>
  <mirror> 
      <id>central</id> 
      <mirrorOf>*</mirrorOf> 
      <name>central-mirror</name> 
      <url>http://域名或IP:8081/nexus/content/groups/public/</url> 
  </mirror> 
</mirrors>

至此,搭建和配置完毕

上一篇 下一篇

猜你喜欢

热点阅读