zoukankan      html  css  js  c++  java
  • Nexus搭建Maven私有仓库

    原文:http://blog.csdn.net/rickyit/article/details/54927101

    前言

    Nexus Repository Manager is a Java application that requires a Java Runtime Environment. When you run Nexus Repository Manager, you are running a server application with a web-based user interface. The application itself runs with the Eclipse Jetty servlet Containerand Apache Karaf OSGi-container.

    此次搭建是在Windows平台上操作的,搭建之前需要先安装JDK。

    1.下载

    最新版是nexus-3.2.0-01-win64.zip,可以从官网下载

    2.注册服务

    运行以下命令,注册为服务。 
    nexus.exe /install Nexus Service

    这里写图片描述

    配置成功。

    这里写图片描述

    3.启动服务

    这里写图片描述

    这里写图片描述

    4.访问

    这里写图片描述

    5.登录

    用户名:admin; 
    密码:admin123

    这里写图片描述

    这里写图片描述

    没有Maven相关的jar包。

    这里写图片描述

    6.使用

    使用maven-public仓库

    maven配置

    这里写图片描述

    C:UsersAdministrator.m2settings.xml中添加以下配置

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

    package

    在工程目录下,运行命令:mvn clean package

    这里写图片描述

    开始从私服下载jar包,快了很多。

    私服中增加的jar包。

    这里写图片描述

    deploy

    用IntelliJ IDEA,远程部署jar到私服。

    1. settings.xml配置用户名和密码

    一定要是C:Users用户名.m2settings.xml下面的settings.xml,IDEA在deploy的时候会在这个路径下面查找远程私服的用户名和密码。

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

    2. pom.xml文件配置

        <distributionManagement>
            <snapshotRepository>
                <id>snapshots</id>
                <url>http://localhost:8081/repository/maven-snapshots/</url>
            </snapshotRepository>
        </distributionManagement>

    3. deploy

    运行命令mvn clean -Dmaven.test.skip=true deploy

    这里写图片描述

    4. 成功

    这里写图片描述

    这里写图片描述

    依赖使用

    项目使用上传到私服的jar,运行命令mvn clean package

    这里写图片描述

    更多命令可以参考官方文档

  • 相关阅读:
    定义通用类型,便于移植和32位、64位的编译
    映射密码的加密,解密以及暴力破解
    位移密码的加密,解密以及暴力破解
    TCP三次握手和四次挥手通俗理解
    git常用命令
    pip及npm换源
    win10安装Docker并换国内源
    搜索引擎工作原理
    wsgi_uwsgi_nginx理论知识
    课程全文检索接口
  • 原文地址:https://www.cnblogs.com/shihaiming/p/6408350.html
Copyright © 2011-2022 走看看