美文网首页黑科技
Maven 私服搭建

Maven 私服搭建

作者: 天一方蓝 | 来源:发表于2019-08-14 14:18 被阅读58次

简介

在使用 Maven 打包项目时我们需要依赖自己或其他同事开发的项目,这些项目在 Maven 中央仓库里是不存在的,我们也不能每次都是以通过编译源码的方式将这些依赖安装到本地仓库中,此时就需要 Maven 私服来帮我解决项目依赖的管理问题

docker-compose.yml

version: '3.1'
services:
  nexus:
    restart: always
    image: shifudao/nexus3
    container_name: nexus
    ports:
      - 8081:8081
    volumes:
      - /usr/local/docker/nexus/data:/nexus-data

登录控制台

地址:http://192.168.75.136:8081/

用户名:admin

密码:admin123

image.png

设置代理仓库

pom.xml 中增加配置

<repositories>
    <repository>
        <id>maven-snapshots</id>
        <name>maven-snapshots</name>
        <url>http://192.168.75.136:8081/repository/maven-snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>

部署管理

pom.xml 中增加配置

<distributionManagement>
    <snapshotRepository>
        <id>nexus</id>
        <name>Nexus Snapshot</name>
        <url>http://192.168.75.136:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>nexus</id>
        <name>Nexus Releases</name>
        <url>http://192.168.75.136:8081/repository/maven-releases/</url>
    </repository>
</distributionManagement>

配置 Maven 服务器认证

<server>
    <id>nexus</id>
    <username>admin</username>
    <password>admin123</password>
</server>
image.png

部署工程到私服

mvn deploy

部署成功效果图

image.png

相关文章

  • 搭建Maven 私服 (Android周边记录1)

    搭建Maven 私服 本文整理目前网络上关于NEXUS搭建Maven私服的文章,记录关于如何搭建一个属于自己的Ma...

  • Ubuntu server下搭建Maven私服Nexus

    Ubuntu server下搭建Maven私服Nexus Maven私服Nexus的作用,主要是为了节省资源,在内...

  • 8 私服相关

    1 私服:nexus搭建流程Maven Nexus3私服搭建指南https://www.jianshu.com/p...

  • centos 7 安装 nexus3 和 docker 安装ne

    搭建nexus私服(私服虚拟机) 公司里一般都会用nexus搭建一个私服,然后将内部的代码上传到私服的maven仓...

  • nexus 创建私服仓库上传jar包

    前提条件 : 本地搭建好nexus私服仓库 如何搭建nexus私服请参考: Nexus、Maven仓库介绍以及在项...

  • Maven私服Nexus的搭建

    Maven私服Nexus的搭建 私服存在的合理性 Maven中的依赖是从服务器仓库中下载的,Maven的仓库只有两...

  • maven学习记录

    Maven+Nexus 私服的搭建 Maven中release和snapshot,release是上传新的版本,...

  • 搭建Maven私服-Nexus

    Maven 私服,可以代理远程仓库和部署自己或第三方构件。本文介绍使用最广泛搭建 Maven 私服的工具: Son...

  • 使用Nexus2搭建私有库

    本文梳理了一些使用Nexus搭建Maven私服的方法。Maven私服Nexus的作用,主要是为了节省资源,在内部作...

  • Maven私服(nexus)

    Maven私服搭建- nexus公司内部搭建。测试团队,运维团队,开发团队,所有团队共用。私服本身也是一个公司内的...

网友评论

    本文标题:Maven 私服搭建

    本文链接:https://www.haomeiwen.com/subject/siugjctx.html