搭建Nexus私服实现本地拉取依赖包

转载于https://dbawsp.com/1439.html

安装JDK与Nexus环境:

修改主机名:

hostnamectl set-hostname nexus
bash

 

网站内搜索:

jdk-8u181-linux-x64.rpm
mkdir /home/tools && cd /home/tools

 

点击下载JDK环境RPM包

rpm -ivh jdk-8u181-linux-x64.rpm

 

下载Nexus程序:

点击下载Nexus程序包

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

部署并启动Nexus程序:

tar xf nexus-3.13.0-01-unix.tar.gz
mv nexus-3.13.0-01 /usr/local/nexus
cd /usr/local/nexus/bin/
./nexus start

 

Nexus会把所有磁盘当成存储空间,硬盘越大,启动越慢

查看Nexus端口:

netstat -tunpl|grep '8081'

 

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

界面操作Nexus:

用户:admin
密码:admin123

 

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客

配置Maven全局配置:

cd /usr/local/maven/conf/ && vim settings.xml

 

找到 标签,添加 Nexus 默认认证信息:(132行下)

    <server>
        <id>my-nexus-releases</id>
        <username>admin</username>
        <password>admin123</password> 
      </server>
      <server>
        <id>my-nexus-snapshot</id>
        <username>admin</username>
        <password>admin123</password>
      </server>

 

找到 标签,在修改server标签后添加镜像:(168行下)

    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://10.0.0.80:8081/repository/maven-public/</url>
    </mirror>

 

找到 标签,在修改mirrir标签后添加仓库信息:(262行下)

<profile>
  <id>nexus</id>
  <!--Enable snapshots for the built in central repo to direct -->
  <!--all requests to nexus via the mirror -->
  <repositories>
    <repository>
      <id>central</id>
      <url>http://10.0.0.80:8081/repository/maven-public/</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
  </repositories>
 <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://10.0.0.80:8081/repository/maven-public/</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>

 

激活仓库:(293行下)

<activeProfiles>
  <!--make the profile active all the time -->
  <activeProfile>nexus</activeProfile>
</activeProfiles>

 

上传并解压jeesns源码包:

cd /tmp/ && tar xf jeesns.tar.gz && cd jeesns/

 

编译源码包:

rm -rf /root/.m2/
mvn clean package

 

搭建Nexus私服实现本地拉取依赖包-风君雪科技博客