私服搭建

**搭建私服**

1. 安装nexus,nexus是maven的仓库管理器,使用它搭建私服。
* 第一步:解压nexus-2.12.0-01-bundle.zip文件
* 第二步:开启nexus的服务,进入到nexus-2.12.0-01\bin目录下(强调:要使用管理员的权限打开dos窗口)
* cd D:\class\resource\nexus\nexus-2.12.0-01\bin
* d: 回车进入
* 输入命令:nexus install
* 强调:如果想卸载nexus,输入命令:nexus uninstall

* 启动服务,输入命令:nexus start

* 第三步:找到conf目录下的nexus.properties配置文件,里面包含nexus的访问地址
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

* 访问地址:http://localhost:8081/nexus

* 第四步:使用默认账号登录
* 用户名:admin
* 密码:admin123

2. 查看nexus的仓库类型
* Hosted:宿主仓库
* 放入本公司开发的测试版本jar包,正式版本的jar包。

* Proxy:代理仓库
* 用于代理远程的公共仓库,例如maven的中央仓库。当用户连接私服,如果私服中没有jar包,会默认从中央仓库下载jar包。

* Group:组仓库
* 将其他仓库组合到一起,将来直接连接组仓库。

* Virtual:虚拟仓库(不用)
* Maven1的jar包

----------

**把本地jar包上传到私服(不用记配置文件)**

1. Maven解压安装包中conf\setttings.xml文件中,配置私服用户名、密码
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>

2. 在所要上传的项目中pom.xml中指定往哪传
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

3. 输入命令:deploy上传

----------

**从私服上下载jar包**

1. 在settings.xml配置文件中配置模板,告诉maven从哪下载jar包,配置组仓库
<profile>
<!--profile的id-->
<id>dev</id>
<repositories>
<repository>
<!--仓库id,repositories可以配置多个仓库,保证id不重复-->
<id>nexus</id>
<!--仓库地址,即nexus仓库组的地址-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!--是否下载releases构件-->
<releases>
<enabled>true</enabled>
</releases>
<!--是否下载snapshots构件-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
<pluginRepository>
<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>

2. 在settings.xml配置文件中激活模板
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>

3. 进行测试
* 把ssh_dao子工程关闭掉,但是service会引用dao的jar包。
* 再把本地仓库的daojar包也删除掉
* 更新service的项目,会发现从组仓库中下载jar包到本地仓库。

时间: 2024-08-04 23:25:14

私服搭建的相关文章

Nexus Maven 私服搭建

1.下载Nexus安装文件:http://www.sonatype.org/nexus/go ,目前是nexus-2.13.0-01-bundle.tar.zip这个最新版本: 2.解压到任意目录,我这里解压到E盘,进入F:\nexus-2.13.0-01\bin\jsw\windows-x86-64,点击install-nexus.bat安装成为windows服务,这里选择自己计算机对应的文件: 3.访问http://localhost:8081/nexus/,这就是私服:默认用户名admin

maven 学习笔记--仓库,聚合和继承,私服搭建

仓库 http://blog.csdn.net/wanghantong/article/details/36427433 聚合和继承 http://www.cnblogs.com/xdp-gacl/p/4242221.html 私服搭建 http://www.cnblogs.com/xdp-gacl/p/4068967.html

docker私服搭建nexus3

docker私服搭建有官方的registry镜像,也有改版后的NexusOss3.x,因为maven的原因搭建了nexus,所以一并将docker私服也搭建到nexus上. nexus的安装过程就单独说了,如果是2.x系列需要升级到2.14版本再升级到3.y系列,如果3.x到3.y直接升级就可以. 从3.0版本开始,nexus不再只是一个maven仓库,还可以是docker.npm.bower的私有仓库. 配置SSL docker的仓库链接是基于HTTPS的,故一般情况下需要将nexus的访问方

maven介绍及私服搭建

1.Maven介绍Maven是款平台的项目管理工具.主要服务于基于java平台的项目构建,依赖管理和项目信息管理.2.Maven私服搭建环境介绍: 系统:Centos 7.4 64位.Jdk:1.8.maven:3.3.9.Nexus:2.5IP:192.168.154.1003.JDK环境安装#tar xf jdk-8u65-linux-x64.tar.gz -C /usr/local/#cd /usr/local/#ln -s jdk1.8.0_65/ jdk#echo "JAVA_HOME

SuSE之Gitlab私服搭建

Gitlab私服搭建 Ps:由于是内网使用不存在邮件派发,不配置邮件,且无需异步服务器代理转发 直接过程: 1.下载bitnami-gitlab-8.9.6-0-linux-x64-installer.run(版本自选) 2.安装: YDCK-WXCAPP1:/soft # ./bitnami-gitlab-8.9.6-0-linux-x64-installer.run The installer detects that exists a 'git' user in the system. T

【maven】私服搭建

转自:https://www.cnblogs.com/likehua/p/4552620.html 一.软件安装 地址:http://www.sonatype.org/nexus/thank-you-for-downloading/?dl=tgz 解压:   启动: >> nexus start 打开:http://192.9.104.17:8081/nexus/#welcome 点击右上角,使用admin/admin123(默认管理员)登陆. 管理操作面板(修改代码库.镜像.用户权限管理等)

linux环境下jdk 安装以及maven私服搭建

1:准备资源 linux服务器,jdk和nexus  安装包 2:网络通畅,保持windows端和linux服务器端网络通畅. 3: 安装jdk和配置环境变量 进入到jdk安装文件的目录夹 usr/java 1: 进入到安装文件的目录夹  cd ~命令到根目录下  在cd usr/java 2:授权 chmod 755 jdk-7u55-linux-x64.tar.gz 3: tar -zxvf jdk-7u55-linux-x64.tar.gz mv 解压的文件夹名  jdk1.7 修改 /e

maven+nexus私服搭建

1.下载nexus安装包  网址:http://www.sonatype.org/nexus/archived/ 注意:从nexus2.6.0,jdk版本要求7.0以上,本文下载的是nexus-oss-webapp-1.9.2.4-bundle 2 启动nexus服务 在E盘解压,进入nexus的文件目录:E:\nexus-oss-webapp-1.9.2.4-bundle\nexus-oss-webapp-1.9.2.4\bin\jsw\windows-x86-64下面,windows-x86

Maven私服搭建

1. 为什么使用Nexus 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下载构件无疑加大了仓库的负载和浪费了外网带宽,如果网速慢的话,还会影响项目的进程.很多情况下项目的开发都是在内网进行的,连接不到maven仓库怎么办呢?开发的公共构件怎么让其它项目使用?这个时候我们不得不为自己的团队搭建属于自己的maven私服,这样既节省了网络带宽也会加速项目搭建的进程,当然前提条件就是你的私服中拥有项目所需的