搭建互联网架构学习--003--maven以及nexus私服搭建
跳过,等待完善中,,,
后台服务工具maven:使用Nexus配置Maven私有仓库
一、安装配置Nexus
1、 下载nexus
https://www.sonatype.com/download-oss-sonatype
2、 解压:tar -zxf nexus-3.5.2-01-unix.tar.gz
3、 进入bin目录启动:./nexus run &
出现如下界面启动成功
-------------------------------------------------
Started Sonatype Nexus OSS 3.5.2-01
-------------------------------------------------
4、 访问http://192.168.75.3:8081/ 可以登录
默认端口号:8081
默认账号:admin
默认密码:admin123
5、 配置修改
5.1、修改运行nexus3所使用的用户:
[root@bigdata1 bin]#vi nexus.rc
run_as_user=”root”
5.2、修改nexus3启动所使用的jdk版本
[root@bigdata1 bin]#vi nexus
INSTALL4J_JAVA_HOME_OVERRIDE=/data/program/software/java8
5.3、修改nexus3默认端口
[root@bigdata1 etc]# vi nexus-default.properties
application-port=8282
5.4、修改nexus3数据以及相关日志的存储位置
[root@bigdata1 etc]# vi nexus.vmoptions
-XX:LogFile=./sonatype-work/nexus3/log/jvm.log
-Dkaraf.data=./sonatype-work/nexus3
-Djava.io.tmpdir=./sonatype-work/nexus3/tmp
二、修改settings.xml配置,使用nexus私有库
<?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>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
这是Server的ID(不是登录进来的user),与Maven想要连接上的repository/mirror中的id元素相匹配。username,password:这两个元素成对出现,表示连接这个server需要验证username和password。在nexus中,默认管理员用户名为admin,密码为admin123。这里使用两个服务器配置,分别对应release和snapshot。
<mirrors>
<mirror>
<id>nexus-releases</id>
<mirrorOf>*</mirrorOf>
<url>http://10.211.55.7:8081/repository/maven-public/</url>
</mirror>
<mirror>
<id>nexus-snapshots</id>
<mirrorOf>*</mirrorOf>
<url>http://10.211.55.7:8081/repository/maven-snapshots/</url>
</mirror>
</mirrors>
id,name:唯一的镜像标识和用户友好的镜像名称。id被用来区分mirror元素,并且当连接时候被用来获得相应的证书。
mirrorOf:镜像所包含的仓库的Id。例如,指向Maven central仓库的镜像(http://repo1.maven.org/maven2/),设置这个元素为central。更多的高级映射例如repo1,repo2 或者*,!inhouse都是可以的。没必要一定和mirror的id相匹配。在这里mirrorOf项当然应该使用*,以表明是所有仓库都会被镜像到指定的地址。
url:镜像基本的URL,构建系统将使用这个URL来连接仓库。这里应该添nexus仓库的地址,地址可以在nexus仓库页面中找到。
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus-releases</id>
<url>http://nexus-releases</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>nexus-snapshots</id>
<url>http://nexus-snapshots</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus-releases</id>
<url>http://nexus-releases</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus-snapshots</id>
<url>http://nexus-snapshots</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
profile项代表maven的基本配置。按照maven的一贯尿性,很多xml的配置项都会有一个配置项的复数形式作为父节点,以保证该配置项可以配置多个。在profiles项中,当然也可以配置多个profile,不过在这里配一个就够了。下面介绍profile项的各个子节点。
id:用来确定该profile的唯一标识。
repositories/repository:用以规定依赖包仓库的相关信息。在下属节点中,id就不用多说了;URL是指仓库地址,这里使用伪造的地址,否则即使设置了mirror,maven也有可能会直接从中央仓库下载包;releases和snapshots放在一块说吧,这两个节点下属的enable节点用以规定对应的依赖包是否对当前策略有效,假如将snapshot的enable项设为disable,则不会下载snapshot包。
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
用以规定当前启用的配置,将对应profile的ID加入到这一项即可使profile生效。
三、上传jar到nexus
第一种方式:
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=dubbo -Dversion=2.8.4 -Dpackaging=jar -Dfile=/Users/zhangyong/Documents/software/dubbo-2.8.4.jar -Durl=http://10.211.55.7:8081/repository/maven-releases/ -DrepositoryId=nexus-releases
DrepositoryId和settings.xml里配置的id一样
第二种方式:
代码的pom.xml中直接接入
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>maven-releases</name>
<url>http://10.211.55.7:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
mvn deploy
搭建互联网架构学习--003--maven以及nexus私服搭建的更多相关文章
- 搭建互联网架构学习--005--框架初步拆分ssm单一框架
经过前边的准备步骤,服务器基本搭建完毕,接下来就开始一步步搭建框架了. 拆分单一结构:拆分的目的是为下一步引入dubbo做准备的. 把下边这个单一maven框架进行拆分 这个就是一个简单的maven项 ...
- 搭建互联网架构学习--006--duboo准备之zk集群部署安装
dubbo集群部署安装依赖于zookeeper,所以先安装zookeeper集群. 1.准备三台机器做集群 2.配置 配置java环境 ,2,修改操作系统的/etc/hosts文件,添加IP与主机名 ...
- 搭建互联网架构学习--004--centos安装Mysql
Mysql安装 1. yum安装mysql yum -y install mysql-server 2. 启动mysql服务 启动mysql:service mysqld start 查看mysql的 ...
- nexus私服搭建及信息配置
nexus私服搭建及信息配置 下载 登录nexus官网下载nexus安装包https://help.sonatype.com/repomanager2/download/download-archiv ...
- Maven仓库搭建--nexus私服
Maven仓库搭建--nexus私服(Linux环境) Maven仓库简介 Maven仓库分为本地仓库.远程仓库.私服.本文重点介绍私服的使用方法. 下载安装包 网址:http://www.sonat ...
- ava Maven项目之Nexus私服搭建和版本管理应用
目录: Nexus介绍 环境.软件准备 Nexus服务搭建 Java Maven项目版本管理应用 FAQ 1.Nexus介绍 Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维 ...
- Maven使用教程二:nexus私服搭建及使用
nexus安装 从nexus官网 下载最新的安装包 1.打开命令行,切换到nexus-3.2.1-01/bin目录下,回车.例:C:\Nexus\nexus-3.2.1-01\bin 2.输入:nex ...
- Java Maven项目之Nexus私服搭建和版本管理应用
转载自:https://cloud.tencent.com/developer/article/1010603 1.Nexus介绍 Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓 ...
- nexus私服搭建及maven生命周期
一.maven找库流程 从流程上看创建nexus私服,能够优化流程,而且更加快速 二.nexus下载.安装 1.nexus下载地址 https://sonatype-download.global.s ...
随机推荐
- c语言中几个常见的库函数strlen、strcmp、strcat、strcpy、strncpy、memset、memcpy、memmove、mmap
1.strlen() 1)计算给定字符串的长度,不包括’\0’在内 unsigned int strlen(const char *s) { assert(NULL != s);//如果条件不满足,则 ...
- gj3 Python数据模型(魔法函数)
3.1 什么是魔法函数 类里面,实现某些特性的内置函数,类似 def __xx__(): 的形式. 不要自己定义XX,并不是和某个类挂钩的 class Company(object): def __i ...
- SGU 169 Numbers (找规律)
题意:中文题,直接忽略... 析:先说说我的思路,我一看这个题第一感觉就是要找规律,要是挨着算,猴年马月都跑不完,更何况时间限制是0.25s,怎么找规律呢,我算了一下前10位,分别是8,1,1,3,1 ...
- ArcGIS Desktop Python add-ins 插件类型
Python可以在ArcGIS 桌面程序中创建如下的插件类型: 插件类型 描述 按钮(button) 是一个简单功能定制形式,可以在点击情况下执行一些业务逻辑.它会执行一个或一系列的动作.按钮可以放在 ...
- ESRI.ArcGIS.AnalysisTools.Erase 结果是空?
用ESRI.ArcGIS.AnalysisTools.Erase擦除,结果总是空的. 这几天一直纠结一个问题,就是在AE下使用ESRI.ArcGIS.AnalysisTools中的工具(例如:泰森多边 ...
- python技巧31[python中使用enum][转]
以下几种方法来模拟enum:(感觉方法一简单实用) # way1 class Directions: up = 0 down = 1 left = 2 right =3 ...
- post同步请求
// http://api.hudong.com/iphonexml.do?type=focus-c //post请求中url不带请求参数,请求参数在参数HTTPBody中设置, 需要创建可变 ...
- 【翻译】JavaScript循环和作用域
我的翻译小站:https://www.zcfy.cc/article/javascript-loops-and-scope 翻译原文链接:https://flaviocopes.com/javascr ...
- DagScheduler 和 TaskScheduler
DagScheduler 和 TaskScheduler 的任务交接 spark 调度器分为两个部分, 一个是 DagScheduler, 一个是 TaskScheduler, DagSchedule ...
- http://www.cnblogs.com/xalion/p/5111279.html
https://quality.embarcadero.com/secure/Dashboard.jspa 注册成 delphi qc