1.可以为maven项目单独配置nexus路径

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 导入三个 模块 -->
<modules>
<module>../user-core</module>
<module>../user-log</module>
<module>../user-service</module>
</modules>
<groupId>zttc.itat.user</groupId>
<artifactId>user-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!--设定工厂地址,更好的方式是在maven的setting配置文件中设置 这样所有项目都能使用私服的工厂 -->
<repositories>
  <repository>
    <id>nexus</id>
    <name>nexus repository</name>
    <url>http://localhost:8081/nexus/content/groups/public/</url>
    <releases>
    <!--releases默认为true-->
    <enabled>true</enabled>
    </releases>
    <snapshots>
    <!--snapshots默认为false-->
    <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories> </project>

2.也可以在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>D:\JAVA\MavenRepository</localRepository>

<profiles>

<profile>

      <id>nexusProfile</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<!-- releases默认为true -->
<enabled>true</enabled>
</releases>
<snapshots>
<!-- snapshots默认为false -->
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!--激活profile-->
<activeProfiles>
<activeProfile>nexusProfile</activeProfile>
</activeProfiles>
</settings>

3.使用镜像让maven只能访问私服

<!--使用镜像让maven只能访问私服-->
<mirror>
  <id>nexusMirror</id>
  <!--使用了profile下的repository的id:nexus和lib下的maven-model-builder-3.2.1.jar包的pom.xml下的repository的id:central-->
  <!--<mirrorOf>nexus,central</mirrorOf>-->
  <!-- *表示使用所有的工厂都替换为下面的url-->
  <mirrorOf>*</mirrorOf>
  <name>Human Readable Name for this Mirror.</name>
  <url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>

4.发布项目到nexus

pom.xml

    <distributionManagement>
<repository>
<id>user-release</id>
<name>user release resp</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>user-snapshot</id>
<name>user snapshot resp</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository> </distributionManagement>

setting.xml

     <server>
<id>user-release</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>user-snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>

Nexus配置的更多相关文章

  1. 为Nexus配置阿里云代理仓库【转】

    Nexus默认远程仓库为https://repo1.maven.org/maven2/ 慢死,还常连不上. 可以添加阿里云代理仓库 URL:http://maven.aliyun.com/nexus/ ...

  2. 架构(二)Maven安装以及Nexus配置

    一 Maven安装配置 1.1 下载 http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-ma ...

  3. 使用Nexus配置Maven私有仓库

    使用Nexus配置Maven私有仓库 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装配置Nexus 1>.下载nexus 下载地址:https://www.sonat ...

  4. 【Maven】Nexus配置和使用

    Nexus安装 nexus安装,可以参照:[Maven]Nexus(Maven仓库私服)下载与安装 Nexus简单说明 用途:指定私服的中央地址.将自己的Maven项目指定到私服地址.从私服下载中央库 ...

  5. Gradle nexus配置

    1.下载Gradle; 2.添加脚本init.gradle到gradle的init.d目录中: ext { nexus = 'http://192.168.184.6:8081/nexus' user ...

  6. maven+nexus配置本地私有仓库

    以下是settting.xml的配置 <?xml version="1.0" encoding="UTF-8"?> <settings> ...

  7. 架构实战项目心得(四):使用Nexus配置Maven私有仓库

    一.安装配置Nexus 1.  下载nexus https://www.sonatype.com/download-oss-sonatype 2.  解压:tar -zxfnexus-3.5.2-01 ...

  8. maven仓库 - nexus配置

    搭建环境: 腾讯云服务器 CentOS 6.8.jdk7.sonatype nexus.maven.Xshell 5 版本信息: jdk : jdk-7u80-linux-x64.tar.gz nex ...

  9. 为Nexus配置阿里云代理仓库

    Nexus默认远程仓库为https://repo1.maven.org/maven2/ 慢死,还常连不上. 可以添加阿里云代理仓库 URL:http://maven.aliyun.com/nexus/ ...

随机推荐

  1. The EM Algorithm

    EM是我一直想深入学习的算法之一,第一次听说是在NLP课中的HMM那一节,为了解决HMM的参数估计问题,使用了EM算法.在之后的MT中的词对齐中也用到了.在Mitchell的书中也提到EM可以用于贝叶 ...

  2. Python-requests之POST Data的json问题

    代码如下: import json import requests r = requests.post(url, data = {"a": json.dumps({"b& ...

  3. CentOS 6 下RPM方式安装MySQL5.6

    CentOS 6 下RPM方式安装MySQL5.6 1. 下载Linux对应的RPM包,如:CentOS6.7_64对应的RPM包,如下:[root@mysql ~]# ll总用量 113808-rw ...

  4. 重力感应操控(unity iphone)

    方案一:speed 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 public var simulateAcceleromet ...

  5. Twitter 登录和分享

    继上面一片介绍了FaceBook的登录和分享,现在再来实现Twitter的登录和分享. 1.首先要说明的是,我没找到官方提供的SDK,查阅很多文章都提到了一个帮助实现的包Twitter4j.jar   ...

  6. CSS3弹性盒模型之box-orient & box-direction

    Css3引入了新的盒模型——弹性盒模型,其实上一篇文章已经讲到了一个box-flex,今天来讲讲另外的两个弹性盒模型属性box-orient 和 box-direction. 1.box-origen ...

  7. TFS 强制撤销别人签出的代码

    有个同事离职一段时间了,今天改一下她的代码,发现有个文件签出了,晕,而且TFS用的也是只允许单用户签出. 1,找原来的用的机器,已经被人占用了,系统已经重做. 2,只有用命令行来搞了. 大致如下: t ...

  8. php面向对象中的魔术方法中文说明

    1.__construct() 实例化对象是被自动调用.当__construct和以类名为函数名的函数 同时存在时调用__construct,另一个不背调用. 类名为函数名的函数为老版的构造函数. 2 ...

  9. Zookeeper 源码分析-启动

    Zookeeper 源码分析-启动 博客分类: Zookeeper   本文主要介绍了zookeeper启动的过程 运行zkServer.sh start命令可以启动zookeeper.入口的main ...

  10. Oralce开窗函数OVER()的一些应用

    好久没用oracle了,发现很多东西已经忘记.正好今天改写个语句,顺便回忆了一下,乘热整理以备遗忘. over(order by salary) 按照salary排序进行累计,order by是个默认 ...