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. C#学习之LinqtoSql类的简单例子

    LinqtoSql类把访问.操作数据库的细节封装了起来,把连接操作数据库变得相当简单.下面是简单的例子. 第一步:添加LinqtoSql类 1.创建一个控制台应用程序项目,下载一个NrothWind ...

  2. UDP/TCP通信小记

    TCP 和UDP的区别 TCP是面向连接的; 所谓连接   就是 打开的时候要握手,收发数据的时候要确认(传说中的窗口协议保持滑动过去的窗口都已成功发送,接收方已经成功接收). UDP是无连接的. 所 ...

  3. linux服务之httpd

    http://mirrors.cnnic.cn/apache/httpd/docs/ 英文pdf文档下载 Apache HTTP Project’s goal It is the Apache HTT ...

  4. org.pentaho.di.ui.core.widget.PasswordTextVar

    package org.pentaho.di.ui.core.widget; import org.eclipse.swt.SWT; import org.eclipse.swt.events.Mod ...

  5. JS日期加减,日期运算

    一.日期减去天数等于第二个日期 function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 ...

  6. 【jmeter】浅说 think time

    接口每天被5000个人调用,同时在线500人,每天要被调用50000次.  过了没多久测试完成写了一份报告发给项目经理: 并发 | 响应时间 | 应用服务器cpu |数据库服务器cpu |TPS | ...

  7. PHP 动态执行

    PHP 动态执行 在页面上直接输入代码,点击执行,返回执行结果 方法很简单,主要使用了 $newfunc = create_function('', $code); 函数来实现. 代码如下: < ...

  8. 安卓 NEXUS6 修改分辨率,density

    NEXUS6原density数值: 2k屏 560 每一步: 使用RE文件管理器,编辑system/build.prop.将“ro.sif.lcd_density=”的参数改写成为需要修改的数值,保存 ...

  9. bzoj4702: 装箱游戏

    Description Alice和Bob正在玩一个非常无聊的游戏以打发时间.游戏是这样的.初始的时候,有n个箱子和m个物品.箱子.物 品都是不同的.因此有nm种方法把这些物品放到箱子里.两个人轮流操 ...

  10. js获取网页的各种高度和宽度

    document.body.clientWidth ==> BODY对象宽度document.body.clientHeight ==> BODY对象高度document.document ...