使用NEXUS搭建MAVEN私服

一、安装 

1.下载地址:https://www.sonatype.com/nexus-repository-oss,ZIP版

2.下载完后,将文件解压,存放到一个目录中。下载完成后,直接将下载后的压缩文件进行解压,存放在磁盘的某个目录下即可

3.将nexus-2.14.12-02in 写入系统环境变量的path下

4.修改配置文件 bin/jsw/conf/wrapper.conf,wrapper.java.command=c:xxxjava1.xxxinjava(java的路径)

5.nexus install安装成WINDOWS服务

6.nexus start启动nexus服务

 

二、添加三方jar包

1.打开localhost:8080/nexus, 使用admin/admin123登录

2.切换到3rd part上,artifact页签上,上传jar包

3.切换到browser index页签上,找到需要使用的jar包,COPY对应的MAVEN信息到项目的POM文件中

 

三、MAVEN的配置 

 打开maven/conf/settings.xml文件,修改成如下:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>c:maven epositories</localRepository>
   
  <pluginGroups></pluginGroups>
  <proxies></proxies>
  <servers>
    <server>
      <id>nexus-releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
  <mirrors></mirrors>
  
  <profiles>
    <profile>
       <id>center</id>
      <repositories>  
        <repository>  
            <id>nexus</id>
            <name>nexus</name>  
            <url>http://localhost:8081/nexus/content/groups/public/</url>  
            <releases>  
                <enabled>true</enabled>  
            </releases>  
            <snapshots>  
                <enabled>true</enabled>  
            </snapshots>  
        </repository>  
      </repositories> 
      <pluginRepositories>  
        <pluginRepository>  
            <id>nexus</id>  
            <name>nexus</name>  
            <url>http://localhost:8081/nexus/content/groups/public/</url>  
            <releases>  
                <enabled>true</enabled>  
            </releases>  
            <snapshots>  
                <enabled>true</enabled>  
            </snapshots>  
        </pluginRepository>  
    </pluginRepositories> 
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>center</activeProfile>
  </activeProfiles>
</settings>

 

 

 

原文地址:https://www.cnblogs.com/liucuiqiang/p/10762437.html