maven 仓库搭建

1  在服务器上安装artifactory,并启动,启动后服务地址为http://hostip:port/artifactory/

hostip:服务器ip

port:服务端口

 

2  在本地maven的settings.xml 文件中加入profile配置

<profile>
      <id>dev</id>
            <repositories>
                  <repository>
                        <id>central</id>
                        <url>http://192.168.99.51:8081/artifactory/repo</url>
                        <snapshots>
                              <enabled>false</enabled>
                        </snapshots>
                        <layout>default</layout>
                  </repository>
                  <repository>
                        <id>snapshots</id>
                        <url>http://192.168.99.51:8081/artifactory/repo</url>
                        <releases>
                              <enabled>false</enabled>
                        </releases>
                        <layout>default</layout>
                  </repository>
            </repositories>
            <pluginRepositories>
                  <pluginRepository>
                        <id>central</id>
                        <url>http://192.168.99.51:8081/artifactory/repo</url>
                        <snapshots>
                              <enabled>false</enabled>
                        </snapshots>
                        <layout>default</layout>
                  </pluginRepository>
                  <pluginRepository>
                        <id>snapshots</id>
                        <url>http://192.168.99.51:8081/artifactory/repo</url>
                        <releases>
                              <enabled>false</enabled>
                        </releases>
                        <layout>default</layout>
                  </pluginRepository>
            </pluginRepositories>
      </profile>      

 

3  在本地使用maven指令时加上 -P dev 即可使用自己搭建的maven仓库。

eg. mvn archetype:create -DgroupId=com.mycompany.app  -DartifactId=myapp -P dev

 

4 artifactory数据仓库说明

 artifactory默认配置了三种仓库,本地(Local),远程(Remote)以及虚拟(Virtual)仓库.

 

本地仓库中的资源url形式为

   http://<host>:<port>/artifactory/<local-repository-name>/<artifact-path>

 

远程仓库中的资源url形式为

 http://<host>:<port>/artifactory/<remote-repository-name>/<artifact-path>或

 http://<host>:<port>/artifactory/<remote-repository-name>-cache/<artifact-path>

 第二种形式只使用已经缓存了的内容;第一种形式在请求的内容不存在时,会从配置的remote服务器上获取。我们可以删除这个仓库中缓存的内容,但不能向其中发布任何内容。

 

虚拟仓库

Artifactory使用一个全局虚拟仓库,可以通过下面的url地址访问

http://<host>:<port>/artifactory/repo
这个仓库包含了所有本地和远程的仓库,因此在配置仓库地址时,只需配置此地址即可。虚拟仓库的请求顺序为:local->remote-cache->remote

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值