为什么要配置私库?
从中央仓库下载速度缓慢,而且有些jar包是公司私有的包不存在在中央仓库当中,所以我们需要配置私库。

首先去修改setting文件,在maven文件夹下的conf文件夹当中

<?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>F:/.m2/repository</localRepository><pluginGroups></pluginGroups><proxies></proxies><!--设置私库认证信息--><servers><server><!--这里的id要与稍后配置的pom中的id一致--><id>nexus-releases</id> <username>admin</username>(这里用的是默认的用户名和密码 一般普通的私库都会有)<password>admin123</password></server><server><id>nexus-snapshots</id><username>admin</username><password>admin123</password></server></servers><!--设置私库mirror 表示maven所有的请求都由nexus来处理--><mirrors><mirror><id>nexus</id><mirrorOf>*</mirrorOf><name>Nexus Mirror.</name><url>http://localhost:8081/nexus/content/groups/public</url>(在实际应用中如果连接的是别人的私库,localhost要改成对方的ip地址才行,路径也是不一样的)</mirror></mirrors><!--设置maven私库信息--><profiles>  <profile><id>nexus</id><repositories><repository><id>nexus</id><name>Nexus</name><url>http://localhost:8081/nexus/content/groups/public/</url>(在实际应用中如果连接的是别人的私库,localhost要改成对方的ip地址才行,路径也是不一样的)<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>(在实际应用中如果连接的是别人的私库,localhost要改成对方的ip地址才行,路径也是不一样的)<releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile><!--覆盖maven中央仓库设置开启releases和snapshots版本的下载--><profile><id>central</id><repositories><repository><id>central</id><url>http://central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><!--激活私库信息的配置--><activeProfiles><activeProfile>nexus</activeProfile><activeProfile>central</activeProfile></activeProfiles>
</settings>

在项目的pom文件中做如下设置

<distributionManagement><repository><id>nexus-releases</id>(注意id要与之前配的setting当中配的id对应)<name>Nexus Releases Repository</name>(随意取名)<url>http://localhost:8081/nexus/content/repositories/releases/</url>(连接别人的私库需要改成对方的ip地址和路径)</repository><snapshotRepository><id>nexus-snapshots</id><name>Nexus Snapshots Repository</name><url>http://localhost:8081/nexus/content/repositories/snapshots/</url></snapshotRepository>
</distributionManagement>

转自:https://www.xuebuyuan.com/1868949.html

maven工程配置私库相关推荐

  1. maven的pom的配置(上传jar包,配置私库,配置第三方库)

    maven仓库配置 仓库优先级为:本地仓库(localRepositories) > profile中的repositories仓库 > POM > mirrors全局仓库 mave ...

  2. Maven精选系列--私库搭建及使用

    转载自 Maven精选系列--私库搭建及使用 为什么要使用私库 maven默认去远程中央仓库下载JAR包的,访问国外网络相当慢,如果团队每个人都去下载一遍无疑是网络的浪费,当然也可以添加国内的镜像,如 ...

  3. 【Scala-spark.mlib】通过Maven工程导入Mlib库

    通过Maven工程导入Mlib包 <!-- Maven/pom.xml --> <dependencies><dependency><groupId>o ...

  4. VC工程配置OpenCV库

    opencv库可以从官网下载:http://opencv.org/(百度一下就有啦) 如下图可以根据自己的系统下载相应的版本: 我只是用过opencv for  windows. 具体的配置步骤是参考 ...

  5. maven安装教程及eclipse中maven工程配置

    环境 jdk环境:jdk1.8.0_241 系统版本:win10 下载maven 官方下载网站 https://maven.apache.org/download.cgi 下载可以直接执行的bin文件 ...

  6. MSP430单片机工程配置driverlib库

    MSP430单片机driverlib库官网下载地址: https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430_Driv ...

  7. Maven私库的安装与使用

    文章目录 一.简介 需要安装的软件 文件的安装包 二.安装JDK 三.安装Maven 1.解压文件 2.Maven环境变量配置: 3.查看版本号 四.安装Nexus Maven私库 1.解压文件 2. ...

  8. 最详细的golang + 私库(gitlab gitee) 模块开发 这一篇文章解决所有问题

    golang独立模块开发流程 大纲 基本概念与背景 模块开发流程总结 基于gitee私库 基于gitlab私库 基本概念与背景 java项目开发过程中,有不同的项目组,有的项目组做业务开发,有的项目组 ...

  9. pom.xml设置mysql连接_maven工程配置pom.xml实现mybatis的访问数据库操作

    pom.xml配置: pom.xml 这个配置还有不足请在下方给出建议 I:  我这里测试三个 : 分别是有@的 DemoMapper(接口): IDemoMapper.interface packa ...

最新文章

  1. 【Python】快速认识Pandas的10大索引
  2. RHEL 5服务篇—使用Apache搭建Web服务(一)
  3. sql查询百分之20到百分之40的数据_数据库基础学习——SQL语言知识总结(6)
  4. 动态规划--背包问题
  5. SAP UI5 ConnectionManager
  6. centos7上配置Samba服务器完成与windows的文件共享
  7. springCloud - 第1篇 - 服务的注册 Eureka
  8. 华科计算机复试ccf成绩,新鲜速递!刚拟录取华科学妹总结的复试攻略,快看
  9. 听着三只松鼠上市的钟声,罗永浩流下了悔恨的泪水
  10. EL表达式判断条件要写在${}内
  11. php strictbool,PHP 7 Bool类型提示不起作用
  12. java基础入门(完整详细版)
  13. 论文笔记——多源融合SLAM的现状与挑战
  14. Google SRE: SLI、SLO、SLA 、Error Budget 详解
  15. 计算机无法连接steam,无法连接至steam网络怎么办 无法连接至steam网络解决方法【图文】...
  16. 计算机网络——域名系统
  17. 《计算机网络》day01-网络的诞生和发展
  18. 设置view 的MarginTop
  19. mysql创建表s c sc_MySqL | 小白创建表
  20. 21个故事的启示(来源于网络)

热门文章

  1. layui 日期重置_layui日历组件,点击清空按钮,让日期插件选中的值清空
  2. Windows下使用Nginx
  3. 综合勤务管控系统服务器,公安勤务管理系统
  4. 上海市高新技术成果转化项目认定政策解读
  5. 快速开发一个三维自动建模程序:自动建模+后端服务+3D Tiles
  6. Python编程 while循环
  7. 全链接神经网络——BP算法推导过程
  8. C#简单的客车售票系统
  9. 揭秘数据解密的关键技术 刘颖东
  10. 2014年1月工作总结