系统使用的系统为win7系统。

1.下载nexus

从官网下载最新版本,下载地址http://www.sonatype.org/nexus/ ,我下载后的压缩包为本地maven私有库nexus设置,将解压后的文件放在F盘(目录可自己选择,最好不要放在系统盘,以免系统恢复时麻烦),解压后的目录如图所示:本地maven私有库nexus设置

文件夹说明:

nexus-2.10.0-02:该文件夹包含了nexus运行需要的文件,如启动脚本、依赖jar包等,该文件夹是非常重要的。

sonatype-work:该文件夹包含了nexus生成的配置文件、日志文件、仓库文件等。

(2)Bundle方式安装nexus

配置环境变量:

新建系统变量,如图:

本地maven私有库nexus设置

其中变量值为nexus-2.10.0-02文件夹路径,我的变量值为F:\nexus-2.10.0-02-bundle\nexus-2.10.0-02。

path环境变量中添加如下值:环境变量path值最前面加入如下地址:%NEXUS_HOME%\bin;

在cmd下启动nexus服务:ce 路径 /bin  nexus.exe/run 启动 nexus


(3)设置nexus

访问路径http://localhost:8081/   Login默认的账号/密码为:admin/admin123

本地maven私有库nexus设置

添加第三方库 选择Maven2(hosted)

本地maven私有库nexus设置

按照系统设置第三方jar库属性

本地maven私有库nexus设置

将第三方库添加到maven-public组策略中

本地maven私有库nexus设置

本地maven私有库nexus设置


(4)第三方库上传jar包步骤

本地maven私有库nexus设置


(5)设置maven setting.xml

<server>  
<id>releases</id>  
<username>admin</username>  
<password>admin123</password>  
</server>  
<server>  
  <id>snapshots</id>  
  <username>admin</username>  
  <password>admin123</password>  
</server> 

  </servers>



<!--设置镜像 规定maven中央库的jar包必须从nexus私有库中取得-->
<mirror>    
  <id>nexusMirror</id> 
  <name>all repository of public thirdparty releases</name>  
  <mirrorOf>central</mirrorOf>         
  <url>http://localhost:8081/repository/maven-public/</url> 
</mirror> 
  </mirrors>
  


  <profiles>
   
<profile>
<id>dev</id>
          <repositories>
             <repository>
                 <id>nexus</id>
             
<url>http://localhost:8081/repository/maven-public/</url>
                 <releases>
                    <enabled>true</enabled>
                 </releases>
                 <snapshots>
                    <enabled>true</enabled>
                 </snapshots>
              </repository>
            </repositories>           
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus</id>
           
<url>http://localhost:8081/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
 </profiles>


相关文章:

  • 2022-12-23
  • 2021-04-30
  • 2022-02-07
  • 2022-02-08
  • 2021-12-03
  • 2021-09-05
猜你喜欢
  • 2021-05-26
  • 2021-12-27
  • 2022-01-13
  • 2021-05-20
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案