私服 nexus

私服 nexus加粗样式**
安装nexus**

启动服务
在这里插入图片描述

在这里插入图片描述

启动失败的解决方法:
在这里插入图片描述

登录nexus
用户名/密码 admin/admin123

仓库类型

在这里插入图片描述
Virtual 虚拟仓库
Proxy 代理仓库
Hosted 宿主仓库 本地仓库
Group 组

需求:
把dao放到私服上,然后service从私服上下载

需求 :将ssh_dao的这个工程打成jar包,并放入到私服上去.
4.1 上传dao
第一步: 需要在客户端即部署dao工程的电脑上配置 maven环境,并修改 settings.xml 文件,配置连接私服的用户和密码 。

此用户名和密码用于私服校验,因为私服需要知道上传都 的账号和密码 是否和私服中的账号和密码 一致。

<server>
  <id>releases</id>
  <username>admin</username>
  <password>admin123</password>
</server>
<server>
  <id>snapshots</id>
  <username>admin</username>
  <password>admin123</password>
</server>

第二步: 配置项目pom.xml

配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓库

	 <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>

注意:pom.xml这里 和 settings.xml 配置 对应!

第三步:执行deploy命令发布到私服

4.2 下载dao
第一步 修改settings.xml

<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>  

		
<activeProfiles>
	  <activeProfile>dev</activeProfile>
	</activeProfiles>

第二步 删除本地仓库中的dao
配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓库

<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>

第三步 update service工程,出现以下信息说明已经成功

4.2 下载dao
第一步 修改settings.xml

	<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>  
	
	
	 <activeProfiles>
	   <activeProfile>dev</activeProfile>
	 </activeProfiles>

第二步 删除本地仓库中的dao

第三步 update service工程,出现以下信息说明已经成功

猜你喜欢

转载自blog.csdn.net/shishize55/article/details/83450152