私服(nexus)
安装nexus 和 启动
- 解压nexus-2.12.0-01-bundle.zip后得到两个文件夹
- 安装:
- 进入到私服的bin目录下: nexus.bat install
- 安装成功后本地服务里会多了个nexus服务,默认没有启动
- 我们通过命令行启动: nexus.bat start
- 启动失败的解决方法: nexus/nexus-2.12.0-01/bin/jsw/conf/wrapper.conf
- 把第15行: wrapper.java.command=xxx(jdk安装路径)/bin/java.exe
- 访问私服:
登录nexu
- 用户名/密码(默认): admin/admin123
仓库类型
- Virtual--->虚拟仓库(不起任何作用,以后也用不到)
- Proxy--->代理仓库
- Hosted--->宿主仓库---本地仓库
- Group--->组
需求
- 把dao放到私服上,然后service从私服上下载
- 第一步:需要在客户端(部署dao工程的电脑)上配置maven环境,并修改settings.xml文件,配置连接私服的用户和密码
- 此用户名和密码用于私服校验,因为私服需要知道上传都的账号和密码是否和私服中的账号和密码一致
- 第二步:配置项目pom.xml,配置私服地址
- 配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓
- 注意:pom.xml这里<id> 和 settings.xml 配置 <id> 对应
- 在maven中配置用户信息(settings.xml)
- 右键-->run as--->maven built...--->deploy
- 修改后pom.xml版本号要改
[XML] 纯文本查看 复制代码
|
01
02
03
04
05
06
07
08
09
10
|
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
|
[XML] 纯文本查看 复制代码
|
01
02
03
04
05
06
07
08
09
10
|
<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>
|
- 将ssh_dao的这个工程打成jar包,并放入到私服上去
- 删除本地仓库中的dao
- update service工程,出现以下信息说明已经成功
[XML] 纯文本查看 复制代码
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
|
|
|