jar包私服artifactory的转移

本文介绍了如何在Ubuntu上迁移Artifactory私服,包括使用旧版本进行安装,备份JAR包,以及导入JAR到新的Artifactory服务器。详细步骤涵盖了用户权限设置、备份与恢复、解决导入时的错误,并提到了设置settings.xml以处理401错误。

  背景:我来公司的时候,公司已经架好了artifactory私服了。我们一直使用,从没有出现过问题,除偶尔添加几个插件外,也没人动他。最近需要整合 服务器。把一些服务集中到一台服务器上。不得不重新安装部署私服,还是使用artifactory吧,保持一致性,稳定省事。

  实施:(错误经历)首先到官方网站上下载一个最新的包1.3.0 ,在linux 按照官方网站上步骤做下去,无果!(很郁闷,我在ubuntu8fedora 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>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值