`
minfree
  • 浏览: 34883 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

maven 仓库搭建

    博客分类:
  • java
阅读更多

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

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics