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

来源:互联网 发布:淘宝直播小二 编辑:程序博客网 时间:2024/05/29 06:56

1.需要在客户端即部署dao工程的电脑上配置 maven环境,并修改 settings.xml 文件,配置连接私服的用户和密码 。

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

图1

添加到settings.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

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

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

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

3 .执行deploy命令发布到私服

图3

图4

从私服上下载

1.修改settings.xml

图1

图2

<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工程,出现以下信息说明已经成功

图

阅读全文
0 0
原创粉丝点击