nexus离线安装索引及一些问题

安装私服~~~

整体流程:

  • 服务器安装私服
  • 配置私服(主要是安装索引)
  • 本地maven配置指向私服

安装私服

win & linux 网上教程很多,不在阐述;


配置私服(及安装index)

1,在线安装index(下载很慢,且不一定能安装成功)

  将Download Remote Indexes值改为true,点击“save”后,点击左边的“Administration”->”Scheduled Tasks”链接,如果没有出现“Update Repositories Index”处于Running状态,那么需要在Public Repositories行右击,点击”Update Index”。

这里写图片描述

  然后再点击Schedule Tasks就可以看到有任务处于Running状态了。

这里写图片描述

  等到索引下载完成之后,就可以在”Repositories”界面中,选择Browser Index选项卡,可以看到Maven中央仓库内容的树形结构,如下图所示。

这里写图片描述

2,离线安装index

  首先将索引下载到本地,下载地址:https://pan.baidu.com/s/1hsFLKzU
解压索引压缩包,将里面内容全部拷贝

  关闭当前Nexus私服,打开Nexus目录%Nexus_Home%sonatype-work exusindexercentral-ctx,首先删除当前目录里所有内容,然后粘贴所下载的索引,最后启动Nexus私服,索引生效。

注:sonatype-work是nexus安装包解压后的文件夹(与Nexus2.0.6同级目录)。也可以自己修改sonatype-work的位置

修改%Nexus_HOME%/conf/nexus.properties
    nexus-work=${bundleBasedir}/../../sonatype-work/nexus

本地maven配置指向私服

<mirror>
         <id>nexus</id>
         <mirrorOf>*</mirrorOf>
         <name>A Local Nexus Server</name>
         <url>http://ip:port/nexus/content/groups/public/</url>
</mirror>
<id>nexus</id>
          <repositories>
            <repository>
              <id>nexus</id>
              <name>Nexus</name>
              <url>http://ip:port/repository/maven-public</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
          </repositories>
          <pluginRepositories>
            <pluginRepository>
              <id>nexus</id>
              <name>Nexus</name>
              <url>http://ip:port/repository/maven-public</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </pluginRepository>
          </pluginRepositories>
   <!--加激活profile-->
      <activeProfiles>
        <activeProfile>nexus</activeProfile>
      </activeProfiles>

遇到问题:中心仓库的仓库状态报下面err

Remote automatically blocked and unavailable java.security.providerException:java.security.keyException

解决:升级nss

[root@localhost ~]# sudo yum upgrade nss
[root@localhost bin]# ./nexus stop 
[root@localhost bin]# ./nexus start

nss:网络安全服务(NSS)是一个旨在支持跨平台的安全功能的客户端和服务器应用程序的开发库。与NSS内置的应用程序可以支持SSL v2和v3,TLS和的PKCS#5,PKCS#7的,的PKCS#11的PKCS#12的S / MIME,X.509 v3证书和其他安全标准

原文地址:https://www.cnblogs.com/itrena/p/5927114.html