travis-ci与bintray依赖关系的工作

时间:2016-08-09 08:43:06

标签: java maven travis-ci

我的travis build job经常失败,因为它无法解决我对来自bintray的工件的依赖关系。

它简单地说:Failed to execute goal on project deployer: Could not resolve dependencies for project com.github.t1:deployer:war:2.2.0-SNAPSHOT: The following artifacts could not be resolved: com.github.t1:test-tools:jar:1.1.1,即使我将bintray添加到pom中的repositories

1 个答案:

答案 0 :(得分:3)

如果依赖项全部位于JCenter,请添加包含以下内容的文件.travis.settings.xml

xml <?xml version="1.0" encoding="UTF-8" ?> <settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd' xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <profiles> <profile> <id>bintray</id> <repositories> <repository> <id>central</id> <name>bintray</name> <url>http://jcenter.bintray.com</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>bintray</activeProfile> </activeProfiles> </settings>

并将以下行添加到.travis.yml

install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --settings .travis.settings.xml

如果您还需要其他存储库中的插件或依赖项,请像在本地settings.xml中一样添加它们。