【maven】之nexus常用的一些配置
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常用的一些配置的更多相关文章
- maven 通过nexus创建工厂的配置
访问中央工厂的地址:http://localhost:8081/nexus/index.html#welcome admin.admin123 查找到自己配置的maven仓库的位置,编辑setti ...
- Maven 插件 maven-tomcat7-plugin - 常用命令及配置
常用命令 tomcat7:deploy 说明:部署 WAR 到 Tomcat tomcat7:help 说明:查看插件帮助信息 tomcat7:run 说明:支行当前项目 配置 <project ...
- (三)Maven基本概念——常用插件的配置
看注释———— pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http ...
- maven 之nexus仓库管理_私服配置
1.下载nexus私服 下载地址:http://www.sonatype.org/downloads/nexus-latest.war 2.解压 解压以下压缩包 3.配置环境变量 *\nexus-2. ...
- Maven仓库Nexus的安装配置
1.下载nexus,最新版本是nexus-2.8.0-05 参考文章 下载nexus-latest-bundle.zip文件后,并解压到 D:\nexus下 配置nexus的环境变量:先配置NE ...
- 配置maven访问nexus,配置项目pom.xml以发布maven项目到nexus中
maven访问nexus有三种配置方法,分别为: 项目pom.xml,优先级最高: user的settings.xml,优先级中,未在pom.xml中配置repository标签,则使用这个配置: m ...
- 【Maven】Nexus配置和使用
Nexus安装 nexus安装,可以参照:[Maven]Nexus(Maven仓库私服)下载与安装 Nexus简单说明 用途:指定私服的中央地址.将自己的Maven项目指定到私服地址.从私服下载中央库 ...
- 配置maven使用nexus
本文简单介绍使用配置maven使用nexus仓库,在团队中使用nexus,避免每个人都从中央仓库去下载依赖,节省带宽,提高下载速度,同时也减少了中央仓库的压力 配置在maven中使用nexus很简单( ...
- Maven仓库管理-Nexus
Maven仓库管理-Nexus @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style& ...
随机推荐
- 『TensorFlow』从磁盘读取数据
十图详解TensorFlow数据读取机制 一.输入流水线读取数据流程 1). 创建文件名列表 相关函数:tf.train.match_filenames_once 2). 创建文件名队列 相关函数:t ...
- 3. Longest Substring Without Repeating Characters无重复字符的最长子串
网址:https://leetcode.com/problems/longest-substring-without-repeating-characters/ 显然采用sliding window滑 ...
- 在git服务器上创建项目过程及遇到的问题
一: 登录git服务器,输入用户名,密码等 二: New Project 添加项目 设置组可见,项目名称等. 创建成功的项目可以看到该项目的clone地址,可以通过http,ssh两种方式来获取: 三 ...
- [luogu P3369]【模板】普通平衡树(Treap/SBT)
[luogu P3369][模板]普通平衡树(Treap/SBT) 题目描述 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 插入x数 删除x数(若有多个相同的数,因只删 ...
- noip模拟ernd
[题目背景]解决了第一题之后,你打开了第二题.这是一道关于树的题目,你很快想出了一个复杂度和树的直径有关的算法,可以通过所有的数据.不过,你的做法常数似乎有点大.为了更好地卡常,你决定构造一些数据来检 ...
- centos7安装doxygen
编译 编译过程参考官网:https://www.stack.nl/~dimitri/doxygen/download.html 编译过程: git clone https://github.com/d ...
- golang 报错illegal rune literal
记录一下,今天运行一端代码遇到这个报错"illegal rune literal",代码如下: func main() { http.HandleFunc('/login', lo ...
- ssh连接虚拟机centos
ssh连接虚拟机centos 虚拟机下CentOS7开启SSH连接 注意:安装虚拟机的时候,网络一定选择桥接模式.
- 第一个java程序以及java的运行机制
课堂要点: 编写第一个java程序以及理解java的运行机制. 1.基本命令介绍: javac命令: 编译java文件得到.class字节码文件 -encoding 参数:指定编译的编码 java命令 ...
- VideoPlayer播放
播放网络视频.本地视频:可以暂停.前后拖动.快进.快退.音量调节.下一个视频 环境:Unity5.6以上 Unity正式发布了5.6版本后,作为5.x版本的最后一版还是有不少给力的更新的.其中新加入了 ...