搭建maven服务器(repository)
原题:搭建Maven2私服摘自:http://www.javaeye.com/topic/143426
周末尝试使用Artifactory搭建了个Maven2的私服,供开发团队使用。于是来到了Artifactory的Jfrog主站,绿色的卡通形象怎么看都不是只青蛙王子,明明是野兽派的忍者神龟嘛。
[*]安装 (Installation) - Actifactory的系统依赖为jdk1.5及java虚拟机400m的堆栈。下载Actifactory后解压到本地目录,因为 Actifactory内置了嵌入式的容器jetty6,所以执行bin目录下的artifactory.bat脚本即可启动。 启动后可访问控制台http://localhost:8081/artifactory/验证服务是否成功启动。默认的用户名为admin,密码为password
[*]配置Actifactory (Configuration) - 安装目录的etc下有3个配置文件jetty.xml,log4j.properties,artifactory.config.xml,通过文件名我 们就已经知道它们的用途了。如果Actifactory服务器不能直接上网,而需HTTP代理的话需打开配置文件的proxies一项,并配置相应的 HTTP代理,配置好后将proxy的key添加到节点的 中,注意配置完成后需在控制台中Reload Configuration一下。eg:
xml 代码
[*]<proxies>
[*] <proxy>
[*] <key>seraph-proxykey>
[*] <host>192.168.1.1host>
[*] <port>80port>
[*] <username>username>
[*] <password>password>
[*] <domain>192.168.1.255domain>
[*] proxy>
[*]proxies>
[*]
[*] <remoteRepository>
[*] <key>repo1key>
[*] <handleReleases>truehandleReleases>
[*] <handleSnapshots>falsehandleSnapshots>
[*] <excludesPattern>org/artifactory/**,org/jfrog/**excludesPattern>
[*] <url>http://repo1.maven.org/maven2url>
[*] <proxyRef>seraph-proxyproxyRef>
[*] remoteRepository>
[*]配置Maven (Setting Up Maven) - 接下来配置maven。将以下配置项配置好后添加到maven的settings.xml或pom.xml中,即可使用搭建起来的maven本地服务器了
xml 代码
[*]<repositories>
[*] <repository>
[*] <id>central</id>
[*] <url>http://:/artifactory/repo</url>
[*] <snapshots>
[*] <enabled>false</enabled>
[*] </snapshots>
[*] </repository>
[*] <repository>
[*] <id>snapshots</id>
[*] <url>http://:/artifactory/repo</url>
[*] <releases>
[*] <enabled>false</enabled>
[*] </releases>
[*] </repository>
[*]</repositories>
[*]<pluginRepositories>
[*] <pluginRepository>
[*] <id>central</id>
[*] <url>http://:/artifactory/plugins-releases</url>
[*] <snapshots>
[*] <enabled>false</enabled>
[*] </snapshots>
[*] </pluginRepository>
[*] <pluginRepository>
[*] <id>snapshots</id>
[*] <url>http://:/artifactory/plugins-snapshots</url>
[*] <releases>
[*] <enabled>false</enabled>
[*] </releases>
[*] </pluginRepository>
[*]</pluginRepositories>
然后mvn下,就可以看到Actifactory在响应你的请求,控制台中也可看到Repositories Tree中的jar越来越多了。
页:
[1]