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. svn tree conflicts 解决方法

    svn resolve --accept working -R XXX. 其中XXX为提示冲突的目录.

  2. Android Apk反编译得到Java源代码

    大家做Android开发,看到别人应用里一些好的功能,是不是很想得到源码,借鉴一下?既然Android是用JAVA开发的,那么我们就能很容易的通过反编译的到应用的源代码.下面我简单介绍下应该怎么操作. ...

  3. 怎么用ABBYY创建属于自己的PDF

    怎么创建一份属于自己的PDF文档呢?由于PDF格式文件具有跨平台.支持超长文件.安全可靠性高等诸多优势,在日常办公学习中应用越来越广泛.而随着技术的发展,各种办公软件也对PDF提供越来越多的支持,但P ...

  4. JS 阻止浏览器默认行为和冒泡事件

    JS 冒泡事件   首先讲解一下js中preventDefault和stopPropagation两个方法的区别: preventDefault方法的起什么作用呢?我们知道比如<a href=& ...

  5. 使用druid连接池的超时回收机制排查连接泄露问题

    在工程中使用了druid连接池,运行一段时间后系统出现异常: Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: ...

  6. android模拟器不能用键盘

    android模拟器不能用键盘?咋整啊?

  7. python psutil 模块

    一.获取系统性能信息 1 .CPU信息 User time,执行用户进程的时间百分比 System time,执行内核进程和中断的百分比 Wait IO,由于IO等待而使CPU处于idle(空闲)状态 ...

  8. nginx服务器应用中遇到的两个问题

    1>首先是413的错误! client_max_body_size Context: http, server, location It is the maximum size of a cli ...

  9. php发送ssl邮件

    <?php /** * 邮件发送类 * 支持发送纯文本邮件和HTML格式的邮件,可以多收件人,多抄送,多秘密抄送,带附件(单个或多个附件),支持到服务器的ssl连接 * 需要的php扩展:soc ...

  10. API文档中,<E>、<T>、<?>分别代表什么意思

    although they are all type parameters, the convention is:E ElementT or S TypeK Key, as in <K, V&g ...