nexus私服主要是在项目和maven中央仓库中间做代理,一般在公司内网或者公司内部的一些私包,都需要这么个产品。下面主要是关于maven和nexus之间的一些配置

1、在pom中配置nexus私服

<!-- jar仓库 -->
<repositories>
<repository>
<id>nexus</id>
<name>nexusRep</name>
<url>http://xxx.74.97.19999:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!-- 插件库 -->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>nexusPlugin</name>
<url>http://xxx.74.97.19999:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<profile>
<id>jdk18</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>

2、在当前项目的pom文件做以上配置,仅仅在当前项目中生效,如果想在所有项目中生效,需要在maven的setting.xml文件中进行配置。

<profile>
<id>nexusProfile</id>
<activation>
<jdk>1.8</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>nexusRep</name>
<url>http://xxx.74.97.19999:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>nexusPlugin</name>
<url>http://xxx.74.97.19999:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexusProfile</activeProfile>
</activeProfiles>

激活当前配置。

这样就可以使所有的项目都使用自己的nexus私服。但是你会发现还有小部分请求会到maven的中央工厂,解决方法就是配置mirror

<mirror>
<id>nexus</id>
<name>nexus</name>
<mirrorOf>*</mirrorOf>
<url>http://xxx.74.97.19999:8081/nexus/content/groups/public/</url>
</mirror>

这样限制住服务只能通过nexus私服去访问maven中央仓库,如果当前的nexus私服宕机了,那么项目是无法使用maven中央仓库数据的。

3、将项目发送到nexus私服中去

首先在pom中配置发布的地址

<distributionManagement>
<repository>
<id>nexus-rep</id>
<name>nexusRep</name>
<url>http://xxx.74.97.xxx:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snap</id>
<name>nexusSnap</name>
<url>http://xxx.74.97.xxx:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

发布项目还需要授权,这个需要在setting文件中配置

<server>
<id>nexus-rep</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>nexus-snap</id>
<username>deployment</username>
<password>deployment123</password>
</server>

执行mvn:deploy,即可发布。

【maven】之nexus常用的一些配置的更多相关文章

  1. maven 通过nexus创建工厂的配置

    访问中央工厂的地址:http://localhost:8081/nexus/index.html#welcome   admin.admin123 查找到自己配置的maven仓库的位置,编辑setti ...

  2. Maven 插件 maven-tomcat7-plugin - 常用命令及配置

    常用命令 tomcat7:deploy 说明:部署 WAR 到 Tomcat tomcat7:help 说明:查看插件帮助信息 tomcat7:run 说明:支行当前项目 配置 <project ...

  3. (三)Maven基本概念——常用插件的配置

    看注释———— pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http ...

  4. maven 之nexus仓库管理_私服配置

    1.下载nexus私服 下载地址:http://www.sonatype.org/downloads/nexus-latest.war 2.解压 解压以下压缩包 3.配置环境变量 *\nexus-2. ...

  5. Maven仓库Nexus的安装配置

    1.下载nexus,最新版本是nexus-2.8.0-05   参考文章 下载nexus-latest-bundle.zip文件后,并解压到  D:\nexus下 配置nexus的环境变量:先配置NE ...

  6. 配置maven访问nexus,配置项目pom.xml以发布maven项目到nexus中

    maven访问nexus有三种配置方法,分别为: 项目pom.xml,优先级最高: user的settings.xml,优先级中,未在pom.xml中配置repository标签,则使用这个配置: m ...

  7. 【Maven】Nexus配置和使用

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

  8. 配置maven使用nexus

    本文简单介绍使用配置maven使用nexus仓库,在团队中使用nexus,避免每个人都从中央仓库去下载依赖,节省带宽,提高下载速度,同时也减少了中央仓库的压力 配置在maven中使用nexus很简单( ...

  9. Maven仓库管理-Nexus

    Maven仓库管理-Nexus @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style& ...

随机推荐

  1. ThinkPHP5.0源码学习之框架启动流程

    ThinkPHP5框架的启动流程图如下: ThinkPHP5的启动流程按照文件分为三步: 1.请求入口(public/index.php) 2.框架启动(thinkphp/start.php) 3.应 ...

  2. 【转】ASP.NET Core开发之HttpContext

    ASP.NET Core中的HttpContext开发,在ASP.NET开发中我们总是会经常用到HttpContext. 那么在ASP.NET Core中要如何使用HttpContext呢,下面就来具 ...

  3. 微服务解决框架--SpringCloud

  4. xftp免费版使用

    转自https://www.jb51.net/softs/621774.html

  5. Nginx的使用(二)Nginx配置wordpress

    安装php:https://windows.php.net/download/,php默认启动命令:php-cgi.exe -b 127.0.0.1:9000 安装wordpress:https:// ...

  6. tar 命令 简易使用方法

    创建压缩文件方法 tar zcf 压缩包存放位置 压缩那个目录/内容 (压缩) 例:在/data目录下压缩/etc/目录,并创建名称为etc.tar.gz [root@web01 /]# tar zc ...

  7. python基础——元组

    元组运算符 与字符串一样,元组之间可以使用 + 号和 * 号进行运算.这就意味着他们可以组合和复制,运算后会生成一个新的元组. Python 表达式 结果 描述 len((1, 2, 3)) 3 计算 ...

  8. union 和 case

    UNION 指令的目的是将两个 SQL 语句的结果合并起来,可以查看你要的查询结果. CASE更多的是一种判断分类,就想其他语言的case一样 1. CASE WHEN 表达式有两种形式 --简单Ca ...

  9. MySQL:数据操作

    数据操作 一.插入数据 1.所有字段插入数据 语法: insert into 数据表名(字段名) values(插入的数据);(标准)insert into 数据表名values(插入的数据); 实例 ...

  10. java学习笔记38(sql注入攻击及解决方法)

    上一篇我们写了jdbc工具类:JDBCUtils ,在这里我们使用该工具类来连接数据库, 在之前我们使用 Statement接口下的executeQuery(sql)方法来执行搜索语句,但是这个接口并 ...