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. QueryRunner使用

    在相继学习了JDBC和数据库操作之后,我们明显感到编写JDBC代码并非一件轻松的事儿.为了帮助我们更高效的学习工作,从JDBC的繁重代码中解脱出来,老佟给我们详尽介绍了一个简化JDBC操作的组件——D ...

  2. [firefox+plug-n-hack]轻松地配置burpsuite代理https流量

    http://zone.wooyun.org/content/25982 需要用到firefox的插件plug-n-hack下载https://raw.githubusercontent.com/mo ...

  3. java编辑器eclipse如何更改jdk版本

    第一步:右键点击项目选择properties   第二步:选择Java Build Path         第三步:选择libraries   第四步:选中当前jre再点击右侧Edit   第五步: ...

  4. winrar 5.21去广告

    http://www.rarlab.com/ 把下面的数据复制到“记事本”中,用文件名“rarreg.key搜索”命名该文件,保存到winrar安装文件夹即完成注册 RAR registration ...

  5. HadoopDoctor:来自腾讯数据仓库TDW的MR诊断系统

    TDW是基于Hadoop生态圈研发的大数据处理平台,MapReduce计算引擎在TDW平台中承担了所有的离线数据计算,是TDW最重要的底层支撑平台之一.在TDW 平台中,除了MR程序会生成MapRed ...

  6. java 实现mysql数据库导出

    package com.zbb.util; import java.io.BufferedReader;import java.io.File;import java.io.FileInputStre ...

  7. RMAN备份与恢复之表空间

    通过以下事例来说明表空间的恢复,删除表空间内的数据文件,删除后在针对位于该表空间的表进行插入记录以及实施检查点进程 SQL> select a.tablespace_name from dba_ ...

  8. smarty变量

    前台: 注释的两种方式:<{**}>和<!--注释html代码-->比如: <{* <div style="width:100px; height:100 ...

  9. jQuery点击图片弹出放大可拖动图片查看

    CSS代码: .popup-bigic { position: absolute; ; ; background: #eee; overflow: hidden; ; } .popup-bigic . ...

  10. Jquery中的offset()和position()

    今天遇到这个偏移量的问题,特做此记录.以便日后查看. 先看看这两个方法的定义. offset(): 获取匹配元素在当前视口的相对偏移. 返回的对象包含两个整形属性:top 和 left.此方法只对可见 ...