【发布时间】:2017-12-08 06:53:26
【问题描述】:
我正在尝试将 java 库发布到 Bintray,然后通过在 gradle 中定义 bintray 存储库在另一个项目中使用该库。
当从我的本地机器部署到 Bintray 时,这一切都有效,但是当我尝试从 Travis CI 让它工作时,它似乎无法正确发布。
当我尝试在不同的 gradle 项目中添加依赖项时,它找不到工件,即使我知道它在哪里并且文件已上传。
我注意到当我使用 Travis 时,maven-metadata.xml 似乎没有正确创建,我的印象是 Bintray 会为我创建它。
.travis.yml
language: java
before_install:
- if [ -n "$TRAVIS_TAG" ]; then ./travis_prebuild.sh; fi
script:
- echo "Building artifacts"
- gradle clean build
- if [ -n "$TRAVIS_TAG" ]; then gradle createPom; fi
before_deploy:
- echo "Creating description file for bintray."
- ./travis_postbuild.sh
deploy:
provider: bintray
file: "descriptor.json"
user: $BINTRAY_USER
key: $BINTRAY_API_KEY
passphrase: $BINTRAY_GPG_PASSWORD
skip_cleanup: true
on:
tags: true
bintray-conf.json
{
"package": {
"name": "core",
"repo": "Qatja",
"subject": "wetcat",
"issue_tracker_url": "https://github.com/Qatja/core/issues",
"vcs_url": "https://github.com/Qatja/core.git",
"labels": ["MQTT", "Java"],
"public_download_numbers": true,
"public_stats": true
},
"version": {
"name": "@VERSION@",
"gpgSign": true
},
"files":
[
{"includePattern": "build/libs/(.*\.jar)", "uploadPattern": "@VERSION@/$1"},
{"includePattern": "build/(.*\.pom)", "uploadPattern": "@VERSION@/$1"}
],
"publish": true
}
【问题讨论】:
-
我永远无法弄清楚为什么这不起作用,最终我选择了脚本部署,因为这似乎是公认的方式。 https://github.com/bintray/gradle-bintray-plugin