背景:我来公司的时候,公司已经架好了artifactory私服了。我们一直使用,从没有出现过问题,除偶尔添加几个插件外,也没人动他。最近需要整合 服务器。把一些服务集中到一台服务器上。不得不重新安装部署私服,还是使用artifactory吧,保持一致性,稳定省事。
实施:(错误经历)首先到官方网站上下载一个最新的包1.3.0 ,在linux下 按照官方网站上步骤做下去,无果!(很郁闷,我在ubuntu8和fedora 6 下都没有成功)
(成功经验)重新下了个1.2.5版本的。按官网说的做,解包,安装,运行,真的很简单。所以就不多写了。我测试环境是ubuntu8.04 成功!据网上说,windows下使用非常简单,解包就能用。做的不错。软件就应该这样。为用户考虑,简单才是硬道理!
artifactory的JAR包的备份 (转)
1、由于我的artifactory是使用用户jetty启动的,所以新增用户jetty能操作的文件夹/usr/jetty
给jetty用户赋予该目录的权限
root@kiko:/usr# sudo chown -R jetty /usr/jetty
root@kiko:/usr# sudo chmod -R g+rws /usr/jetty
2.打开artifactory的管理界面
Export & import----->Repositories----->
Export Repository to Path
在Source local repository 中选择 All Repositories
在Export to path 中填写 /usr/jetty
submit Export
这样就会在目录/usr/jetty中生成目录repositories里面就是artifactory的所有jar包
打成tar包
tar cvzf repos.tar.gz repositories
将repos.tar.gz拷贝下来,以备以后导入用
3.导入JAR到artifactory
将jetty.tar.gz拷贝到/usr,然后揭开压缩tar zxvf jetty.tar.gz
再在菜单中选择Export & Import -----> Repositories ------>Import Repository from Path
Targte local repository 选择 ext=releases-local
Import from path 填写 /usr/jetty
submit Import button
发布所需的jar包
比如,构建richfaces的demo时,报错:
Reason: Unable to download the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.richfaces.ui -DartifactId=richfaces-ui /
-Dversion=3.1.2.GA -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.richfaces.ui -DartifactId=richfaces-ui /
-Dversion=3.1.2.GA -Dpackaging=jar -Dfile=/path/to/file /
-Durl=[url] -DrepositoryId=[id]
org.richfaces.ui:richfaces-ui:jar:3.1.2.GA
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
maven-repository.dev.java.net (http://download.java.net/maven/1),
artifactory (http://192.168.0.253:8081/artifactory/repo)
mvn deploy:deploy-file -DgroupId=com.canoo.webtest -DartifactId=webtest -Dversion=R_1600 -Dpackaging=jar -Dfile="G:/Documents and Settings/david/.m2/repository/com/canoo/webtest/webtest/R_1600/webtest-R_1600.jar" -Durl=http://192.168.0.100:8081/artifactory/repo1-cache -DrepositoryId=artifactory
注:目录中有空格时需要加引号
出现错误:
Error deploying artifact: Failed to transfer file: http://192.168.0.253:8081/artifactory/repo/org/richfaces/ui/richfaces-ui/3.1.2.GA/richfaces-ui-3.1.2.GA.jar. Return code is: 401
这时,就要在~/.m2/settings.xml中添加如下的服务器登录信息(如果目录下没有settings.xml文件,创建一个):
<servers>
<server>
<id>artifactory</id>
<username>admin</username>
<password>password</password>
</server>
</servers>
本文介绍了如何在Ubuntu上迁移Artifactory私服,包括使用旧版本进行安装,备份JAR包,以及导入JAR到新的Artifactory服务器。详细步骤涵盖了用户权限设置、备份与恢复、解决导入时的错误,并提到了设置settings.xml以处理401错误。
2027

被折叠的 条评论
为什么被折叠?



