自建maven仓库

1.搭建maven仓库
docker pull sonatype/nexus3
docker run -d -p 8081:8081 --name nexus sonatype/nexus3

2.登陆
默认的UserName:admin
第一次登陆的时的密码是随机生成的在admin.password文件里面

3.maven仓库的客户端配置
maven的setting.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>${user.home}/.m2/repository</localRepository>

  <offline>false</offline>

  <pluginGroups>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
    <server>
      <id>ccnl-maven-repo</id>
      <username>admin</username>
      <password>password</password>
    </server>
  </servers>

  <mirrors>
    <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <profiles>
  </profiles>
</settings>

4.发布jar包到仓库,配置pom文件

  <distributionManagement>
    <repository>
        <id>maven-releases</id>
        <name>Nexus Release Repository</name>
        <url>http://localhost:8081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>maven-snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://localhost:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

5.从仓库拉jar包,配置pom文件

<repositories>
  <repository>
    <id>nexus</id>
    <url>http://121.4.207.231:8081/repository/maven-public/</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Maven实战》是国内第一本公开出版的 Maven专著。它内容新颖,基于最新发布的 Maven 3.0,不仅详尽讲解 了 Maven 3.0的所有新功能和新特性,而且还将这些新功能和新特性与 Maven 2.x版本进行了对比,以便于正在 使用 Maven 2.x版本的用户能更好地理解。本书它内容全面,以从专家的角度阐释 Maven的价值开篇,全面介绍 了 Maven的安装、配置和基本使用方法,以便于初学者参考;详细讲解了坐标和依赖、Maven仓库、生命周期和 插件、聚合与继承等 Maven的核心概念,建议所有读者仔细阅读;系统性地阐述了使用 Nexus建立私服、使用 Maven进行测试、使用Hudson进行持续集成、使用 Maven构建 Web应用、Maven的版本管理、Maven的灵活构 建、生成项目站点和 Maven的 m2eclipse插件等实用性较强的高级知识,读者可有选择性的阅读;扩展性地讲解 了如何 Maven和 Archetype插件,这部分内容对需要编写插件扩展 Maven或需要编写 Archetype维护自己的项目 骨架以更便于团队开发的读者来说尤为有帮助。它实战性强,不仅绝大部分知识点都有相应的案例,而且本书还 在第 4章设计了一个背景案例,后面的很多章节都是围绕这个案例展开的,可操作性极强。 本书适合所有 Java程序员阅读,无论你是从未使用过 Maven,亦或是已经使用 Maven很长一段时间了,相信你 都能从本书中获得有价值的参考。本书也适合所有项目经理阅读,它能帮助你更规范、更高效地管理 Java项目。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值