两种方法:

1.在单个项目的pom.xml中使用 私服的连接地址,这样只对该项目起作用。

2.在maven的setting.xml配置中添加私服的连接地址。这样对所有项目起作用。

本文章只演示第二种方法:

1.确保nexus私服安装完成并启动。

2.修改本机maven/conf/setting.xml下的配置文件。

完整如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  6. //maven的仓库位置
  7. <localRepository>D:\MAVEN_repository</localRepository>
  8.  
  9. <pluginGroups> </pluginGroups>
  10.  
  11. <proxies> </proxies>
  12. //maven操作nexus的权限设置
  13. </servers>
  14. <server>
  15. <id>nexus-releases</id>
  16. <username>admin</username>
  17. <password>admin123</password>
  18. </server>
  19. <server>
  20. <id>nexus-snapshots</id>
  21. <username>admin</username>
  22. <password>admin123</password>
  23. </server>
  24. <server>
  25. <id>3rd-proty</id>
  26. <username>admin</username>
  27. <password>admin123</password>
  28. </server>
  29. </servers>
  30. //配置镜像,让maven只使用私服获取
  31. <mirrors>
  32. <mirror>
  33. <id>nexus</id>
  34. <name>Nexus Repository</name>
  35. <url>http://10.0.27.61:8081/content/groups/public</url>
  36. <mirrorOf>*</mirrorOf>
  37. </mirror>
  38. </mirrors>
  39. //配置仓库车插件,一旦配置了镜像,则 这个配置可忽略
  40. <profiles>
  41. <profile>
  42. <id>nexus</id>
  43. <repositories>
  44. <repository>
  45. <id>nexus</id>
  46. <url>http://10.0.27.61:8081/content/groups/public</url>
  47. <releases>
  48. <enabled>true</enabled>
  49. </releases>
  50. <snapshots>
  51. <enabled>true</enabled>
  52. </snapshots>
  53. </repository>
  54. </repositories>
  55. <pluginRepositories>
  56. <pluginRepository>
  57. <id>nexus</id>
  58. <url>http://10.0.27.61:8081/content/groups/public</url>
  59. <releases>
  60. <enabled>true</enabled>
  61. </releases>
  62. <snapshots>
  63. <enabled>true</enabled>
  64. </snapshots>
  65. </pluginRepository>
  66. </pluginRepositories>
  67. </profile>
  68. </profiles>
  69. //激活上面的配置
  70. <activeProfiles>
  71. <activeProfile>nexus</activeProfile>
  72. </activeProfiles>
  73.  
  74. </settings>

maven 配置私服 连接的更多相关文章

  1. Maven配置私服仓库

    首先就是,最基本的打开maven的配置文件,上面是我自己的习惯,多留一个以备不坏 打开setting配置文件,来修改路径(本人不习惯将所有软件放在C盘,一般都是单独存放盘) 接下来就是公司给你的账户和 ...

  2. maven配置私服中可能遇到的问题

    文章目录 之前要写一个hsf的demo,maven的依赖是需要alibaba的私服的,所以出现了下面的错误. 具体参看另一篇文章:https://blog.csdn.net/dataiyangu/ar ...

  3. maven配置私服

    1先配置maven的配置文件 2在项目的pom.xml文件增加 <distributionManagement> <repository> <id>nexus-re ...

  4. maven配置(安装&使用&私服)文档

    1.Maven 环境搭建 Maven 是一个基于 Java 的工具,所以要做的第一件事情就是安装 JDK. 系统要求 项目 要求 JDK Maven 3.3 要求 JDK 1.7 或以上 Maven ...

  5. 通过Maven配置测试环境和开发环境连接不同的数据库

    通过Maven配置测试环境和开发环境连接不同的数据库   作者及来源: 通灵宝玉 - 博客园    收藏到→_→: 此文来自: 马开东博客 网址:http://www.makaidong.com   ...

  6. MAVEN总结,整合Eclipse以及配置私服

    对maven的理解 我们知道maven是一个项目管理工具,其核 心特点就是通过maven可以进行jar包的依赖管理,保证jar包版本的一致性,以及可以使多个项目共享jar包,从而能够 在开发大型jav ...

  7. SpringMVC+Spring+Mybatis整合,使用druid连接池,声明式事务,maven配置

    一直对springmvc和mybatis挺怀念的,最近想自己再搭建下框架,然后写点什么. 暂时没有整合缓存,druid也没有做ip地址的过滤.Spring的AOP简单配置了下,也还没具体弄,不知道能不 ...

  8. 配置Maven从私服下载构件

    --------------------siwuxie095                                     配置 Maven 从私服下载构件         从 Nexus ...

  9. 配置maven从私服上下载构件

    maven 本地setting.xml配置 <!--配置maven从私服上下载构件 --> <profiles> <profile> <repositorie ...

随机推荐

  1. Python中的四种数据结构

    Python中的内置数据结构(Built-in Data Structure):列表list.元组tuple.字典dict.集合set,涵盖的仅有部分重点.  目录: 一.列表list 二.元组tup ...

  2. 安装运行zookeeper的坑

    从官网下载zookeeper的地址中有俩文件 一个是apache-zookeeper-3.5.5.tar.gz ,另一个是apache-zookeeper-3.5.5-bin.tar.gz 若是使用前 ...

  3. 常用的框架伪静态(Apache转Nginx)

    EmpireCMS: rewrite ^([^\.]*)/listinfo-(.+?)-(.+?)\.html$ $/e/action/ListInfo/index.php?classid=$& ...

  4. node.js--使用Express中app.use()分模块开发

    app.use(path,callback)中的callback既可以是router对象又可以是函数:将一个URL路径与一个函数绑定,第一个参数为访问的路径,如果第一参数为空,则表示任何路径都触发这个 ...

  5. 72. Edit Distance (JAVA)

    Given two words word1 and word2, find the minimum number of operations required to convert word1 to  ...

  6. rpmdb: Thread/process 10646/3086534416 failed: Thread died in Berkeley DB library

    明明用rpm查看包存在,但删除的时候进程就停住了.后来出现以下错误:rpmdb: Thread/process 10646/3086534416 failed: Thread died in Berk ...

  7. 通过TCP传送结构体的问题

    这个问题在其他博客中已经给出了解决方案,这里结合自己的Demo说一下. 函数调用的库文件是基于TCP协议的封装,在传送消息体的时候,发送消息结果大体如下: XXXXPost(srcid, EVENT, ...

  8. 安装CRMEasy步骤

    生成CRMEasy安装包的步骤: 所需文件: InstallShieldExpress软件 CRMEasy.iwz工程文件 XP系统(虚拟机即可) 安装 CRMEasy 步骤: 1.windows X ...

  9. Windows10家庭版的功能中没有Hyper-V的解决方法

    1.在桌面新建记事本 将下面的内容复制到编辑器或者记事本当中 pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper ...

  10. DevExpress Windows 10 v19.1新版亮点:UWP控件新功能全面解析

    行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPF v19.1中新增的一些控件及部 ...