使用Travis CI将Maven版本部署到Github [英] Deploying a Maven version to Github using Travis CI

查看:92
本文介绍了使用Travis CI将Maven版本部署到Github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功设法使用标签从Maven项目部署JAR到Github。但是,当前配置假定JAR的文件名始终保持不变,而不是。当我做一个新版本时,这将会相应地改变,所以部署将失败。

I successfully managed to deploy a JAR from a maven project to Github using tags. However, current configuration assumes that the file name of the JAR always stays the same, which it doesn't. When I do a new release this will change accordingly so deployment will fail.

有没有办法在YAML文件中使用通配符?从我在Stackoverflow和Web上发现的信息来看,YAML不支持通配符。我无法找到另一种方法来处理.travis.yml文件本身,我想避免它。

Is there a way I can use kind of wildcards in the YAML file? From what I found here on Stackoverflow and on the web, wildcards are not supported in YAML. I couldn't find another hack for doing this without manipulating the .travis.yml file itself, which I would like to avoid.

版本字符串在 pom.xml

当前.travis.yml:

Current .travis.yml:

language: java
jdk:
- openjdk7

deploy:
  provider: releases
  api_key:
    secure: asfdsdflkjsdflkj...
  file: target/helloci-1.0-SNAPSHOT.jar
  on:
    repo: ktk/helloci
    all_branches: true
    tags: true

我可以确定以某种方式编写脚本,但是Travis CI会更改它自己的配置文件,我不确定这个a)是否会起作用,并且b)是个好主意。

I could surely script that somehow but then Travis CI would change its own configuration file and I'm not sure if this a) will work and b) is a good idea.

回购我在玩: https://github.com/ktk/helloci

Repo I'm playing with: https://github.com/ktk/helloci

推荐答案

现在支持通配符,我运行这个设置:

Wildcards are supported now, I run this setup:

before_deploy:
  - "mvn -DskipTests package"
  - export FOO=$(ls target/foo-version-*.jar)

deploy:
  provider: releases
  api_key:
    secure: yep
  file: "${FOO}"

这篇关于使用Travis CI将Maven版本部署到Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆