maven将jar包deploy到Jfrog Artifactory

栏目: Java · 发布时间: 7年前

内容简介:maven将jar包deploy到Jfrog Artifactory

可以采取两种方式,第一种是通过maven的deploy命令,第二种是通过jenkins的 Artifactory 插件。

1. maven的deploy命令

settings.xml 中配置servers和profiles:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>uname</username>
      <password>passwd</password>
      <id>central</id>
    </server>
    <server>
      <username>uname</username>
      <password>passwd</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://localhost:8081/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://localhost:8081/artifactory/libs-snapshot</url>
        </repository>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central-local</id>
          <name>libs-release-local</name>
          <url>http://localhost:8081/artifactory/libs-release-local</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots-local</id>
          <name>libs-snapshot-local</name>
          <url>http://localhost:8081/artifactory/libs-snapshot-local</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://localhost:8081/artifactory/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://localhost:8081/artifactory/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

然后,在 pom.xml 中增加 distributionManagement 节点配置:

<distributionManagement>
    <snapshotRepository>
        <id>snapshots</id>
        <name>snapshots</name>
        <url>http://ci.betalpha.com:8081/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
    <repository>
        <id>central</id>    
        <name>releases</name>
        <url>http://ci.betalpha.com:8081/artifactory/libs-release-local</url>
    </repository>
</distributionManagement>

执行命令:

$ mvn deploy

这种方式比较简单,可以在本地执行,也可以在jenkins中作为 shell 命令执行。

2. jenkins的 Artifactory 插件

首先在jenkin中安装 Artifactory 插件:

Manage Jenkins -> Manage Plugins -> Artifactory Plugin

然后,需要配置servers:

Manage Jenkins -> Configure System -> Artifactory

maven将jar包deploy到Jfrog Artifactory

最后,在项目中配置artifactory和maven:

maven将jar包deploy到Jfrog Artifactory maven将jar包deploy到Jfrog Artifactory maven将jar包deploy到Jfrog Artifactory

这种方式,项目本身不需要关心如何deploy,而且在jenkins上每一个build都会直接关联到JFrog Artifactory上。


以上所述就是小编给大家介绍的《maven将jar包deploy到Jfrog Artifactory》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

个体与交互

个体与交互

Ken Howard、Barry Rogers / 贾永娜、张凯峰 / 机械工业出版社华章公司 / 2012-3-20 / 45.00元

对敏捷软件开发的关注重点,通常都集中在“机制”方面,即过程和工具。“敏捷宣言”认为,个体与交互的价值要高于过程和工具,但这一点很容易被遗忘。在敏捷开发中,如果你重新将注意力放在人的方面,将会收获巨大利益。 本书展示了如何解决敏捷团队在实际项目中遭遇的问题。同时,本书也是很有实用价值的敏捷用户指南,其中包含的故事、最佳实践方法、经验以及技巧均可应用到实际项目当中。通过逐步实践,你将学会如何让团......一起来看看 《个体与交互》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具