论坛首页 Java企业应用论坛

搭建Maven2私服

浏览 9542 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-11-25  
周末尝试使用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添加到<remoterepository>节点的 <proxyref>中,注意配置完成后需在控制台中Reload Configuration一下。eg:</proxyref> </remoterepository>
xml 代码
 
  1. <proxies>  
  2.     <proxy>  
  3.         <key>seraph-proxy<!---->key>  
  4.         <host>192.168.1.1<!---->host>  
  5.         <port>80<!---->port>  
  6.         <username><!---->username>  
  7.         <password><!---->password>  
  8.         <domain>192.168.1.255<!---->domain>  
  9.     <!---->proxy>  
  10. <!---->proxies>  
  11.   
  12.     <remoteRepository>  
  13.         <key>repo1<!---->key>  
  14.         <handleReleases>true<!---->handleReleases>  
  15.         <handleSnapshots>false<!---->handleSnapshots>  
  16.         <excludesPattern>org/artifactory/**,org/jfrog/**<!---->excludesPattern>  
  17.         <url>http://repo1.maven.org/maven2<!---->url>  
  18.         <proxyRef>seraph-proxy<!---->proxyRef>  
  19.     <!---->remoteRepository> 
  • 配置Maven (Setting Up Maven) - 接下来配置maven。将以下配置项配置好后添加到maven的settings.xml或pom.xml中,即可使用搭建起来的maven本地服务器了
xml 代码
 
  1. <repositories>  
  2.     <repository>  
  3.         <id>central</id>  
  4.         <url>http://[your server name]:[port]/artifactory/repo</url>  
  5.         <snapshots>  
  6.             <enabled>false</enabled>  
  7.         </snapshots>  
  8.     </repository>  
  9.     <repository>  
  10.         <id>snapshots</id>  
  11.         <url>http://[your server name]:[port]/artifactory/repo</url>  
  12.         <releases>  
  13.             <enabled>false</enabled>  
  14.         </releases>  
  15.     </repository>  
  16. </repositories>  
  17. <pluginRepositories>  
  18.     <pluginRepository>  
  19.         <id>central</id>  
  20.         <url>http://[your server name]:[port]/artifactory/plugins-releases</url>  
  21.         <snapshots>  
  22.             <enabled>false</enabled>  
  23.         </snapshots>  
  24.     </pluginRepository>  
  25.     <pluginRepository>  
  26.         <id>snapshots</id>  
  27.         <url>http://[your server name]:[port]/artifactory/plugins-snapshots</url>  
  28.         <releases>  
  29.             <enabled>false</enabled>  
  30.         </releases>  
  31.     </pluginRepository>  
  32. </pluginRepositories>  

然后mvn下,就可以看到Actifactory在响应你的请求,控制台中也可看到Repositories Tree中的jar越来越多了。
   发表时间:2008-03-19  
问你一个问题,我按你的方法一步步的做的。我不知道。我怎么叫我的项目,去我的搭建Maven2私服更新jar
<pluginRepositories>  
    <pluginRepository>  
        <id>central</id>  
        <url>http://[your server name]:[port]/artifactory/plugins-releases</url>  
        <snapshots>  
            <enabled>false</enabled>  
        </snapshots>  
    </pluginRepository>  
    <pluginRepository>  
        <id>snapshots</id>  
        <url>http://[your server name]:[port]/artifactory/plugins-snapshots</url>  
        <releases>  
            <enabled>false</enabled>  
        </releases>  
    </pluginRepository>  
</pluginRepositories> 
我将上面的信息配上去settings.xml 就出错。
0 请登录后投票
   发表时间:2008-03-24  
两种方法解决:
(1)在你的maven的settings.xml文件中的<profile><repositories>节点下添加你自己架设的maven服务器信息(有排名顺序)

    
		
		<repository>
			<id>resoft repository</id>
			<name>Resoft Maven Repository</name>
			<url>http://bj-sa-srv21:8081/artifactory/repo</url>
			<layout>default</layout>
		</repository>


(2)在你工程的pom.xml中加入你所指定的本地maven库信息


	<repositories>
		<repository>
			<id>alias repository</id>
			<url>http://your service ip:8081/artifactory/repo</url>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>alias repository</id>
			<name>local artifactory</name>
			<url>http://your service ip:8081/artifactory/repo</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>



如你的artifactory所在服务器不能直接上网还需在etc/artifactory中配置代理服务

settings.xml的标准配置文件在你的maven的conf目录下,可按注释使用
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics