当检索在本地工作时,为什么Travis CI无法检索SNAPSHOT工件?

时间:2017-07-17 09:37:27

标签: java maven travis-ci

我在Travis CI上遇到Could not find artifact org.apache.commons:commons-numbers-core:jar:1.0-SNAPSHOT Maven error,我无法解释,因为我在删除~/.m2/repository并将~/.m2/settings.xml移动到备份位置后在本地运行完全相同的构建命令

错误消息是

[ERROR] Failed to execute goal org.codehaus.izpack:izpack-maven-plugin:5.1.1:izpack (default) on project document-scanner: Execution default of goal org.codehaus.izpack:izpack-maven-plugin:5.1.1:izpack failed: 
Plugin org.codehaus.izpack:izpack-maven-plugin:5.1.1 or one of its dependencies could not be resolved: 
The following artifacts could not be resolved: 
org.apache.commons:commons-numbers-core:jar:1.0-SNAPSHOT,
org.apache.commons:commons-numbers-gamma:jar:1.0-SNAPSHOT,
org.apache.commons:commons-numbers-fraction:jar:1.0-SNAPSHOT,
org.apache.commons:commons-numbers-combinatorics:jar:1.0-SNAPSHOT,
org.apache.commons:commons-numbers-arrays:jar:1.0-SNAPSHOT,
org.apache.commons:commons-numbers-angle:jar:1.0-SNAPSHOT,
org.apache.commons:commons-rng-sampling:jar:1.1-SNAPSHOT:
Could not find artifact org.apache.commons:commons-numbers-core:jar:1.0-SNAPSHOT`

这让我觉得izpack-maven-plugin需要SNAPSHOT版本,所以我无法避免它。

Afaik应该根据repositorypom.xml个元素来获取存储库,这些元素在本地和Travis CI方面是相同的。问题出现在> 12h,现在和100%的时间(重新启动Travis CI构建3次),因此不太可能出现缓存问题。

我正在使用Maven 3.1.1,它是由我修改过的一个依赖项强制执行的,我正在聚合器项目中构建。

1 个答案:

答案 0 :(得分:0)

添加

<repositories>
    <repository>
        <id>apache-snapshots-group</id>
        <name>Apache snapshots group repository</name>
        <url>https://repository.apache.org/content/groups/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
        <!-- fix missing `commons-numbers-core:1.0-SNAPSHOT` on Travis CI
        -->
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>apache-snapshots-group</id>
        <name>Apache snapshots group repository</name>
        <url>https://repository.apache.org/content/groups/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
        <!-- fix missing `commons-numbers-core:1.0-SNAPSHOT` on Travis CI
        -->
</pluginRepositories>

到POM修复了Travis CI上的问题,虽然这并没有解释为什么在本地使用重置系统构建时没有必要(请参阅How to avoid issues with Maven builds on Travis CI which don't occur locally?了解最终解释)。 / p>