【问题标题】:amazon aws artifacts could not be resolved亚马逊 AWS 工件无法解决
【发布时间】:2014-01-12 04:07:34
【问题描述】:

我使用的是 Linux 系统。

我的本地maven repo目录/Users/username/.m2/repository/我有以下目录:

com/amazonaws/android/core/amazon-aws-android-core/1.6.1

表示目录的完整路径是:

/Users/username/.m2/repository/com/amazonaws/android/core/amazon-aws-android-core/1.6.1

在上面的目录下,我有文件:

amazon-aws-android-core-1.6.1.jar.lastUpdated   
amazon-aws-android-core-1.6.1.pom.lastUpdated

在我的项目中,我的pom.xml 包含:

<dependency>
    <groupId>com.amazonaws.android.core</groupId>
    <artifactId>amazon-aws-android-core</artifactId>
    <version>1.6.1</version>
    <type>jar</type>
</dependency>

但是当我运行 mvn clean install 时,我总是收到以下错误消息

The following artifacts could not be resolved: com.amazonaws.android.core:amazon-aws-android-core:jar:1.6.1

为什么会出现上述错误以及如何摆脱它?

【问题讨论】:

    标签: maven amazon-web-services amazon-s3


    【解决方案1】:

    您收到上述错误是因为实际的 .jar 文件不在您的存储库中。 .lastUpdated 文件不是实际的 .jar 文件,而是它们的最新更新版本。 .lastUpdated 文件只是簿记文件。

    例如,让我们创建一个无意义的依赖项:

    <dependency>
        <groupId>asdfasdf</groupId>
        <artifactId>sadffweklsfduasfsdjf</artifactId>
        <version>1.0</version>
    </dependency>
    

    然后在上面运行mvn install

    Maven 然后创建目录~/.m2/repository/asdfasdf/sadffweklsfduasfsdjf/1.0 并用sadffweklsfduasfsdjf-1.0.jar.lastUpdatedsadffweklsfduasfsdjf-1.0.pom.lastUpdated 文件填充它。

    在其中一个 .lastUpdated 文件中,您只需找到如下内容:

    1 #NOTE: This is an Aether internal implementation file, its format can be ch    anged without prior notice.
    2 #Fri Jan 03 09:12:05 IST 2014
    3 http\://repo.maven.apache.org/maven2/.lastUpdated=1388733125394
    4 http\://repo.maven.apache.org/maven2/.error=
    

    而不是实际的 .jar 或 .pom 文件。

    要消除此错误,您需要确保 Maven 确实能够访问远程存储库并下载您需要的实际 Amazon AWS jar。

    【讨论】:

      【解决方案2】:

      .lastUpdated 文件是元数据文件,而不是实际的 jar 和 pom。这种情况表明您可能在未连接到网络或 repo 不可用时尝试下载这些文件,现在 Maven 不会尝试再次下载这些文件,直到经过一定时间。您可以将 -U 开关添加到您的命令中,以强制检查远程存储库上的更新版本。您也可以从本地存储库中删除该工件的文件夹,这也会导致 Maven 尝试再次下载它。

      这里有一个类似的问题: Maven downloads have .lastUpdated as extension 和这里 Maven dependencies in local REPO have .lastUpdated extension

      还有一些关于 lastUpdated 文件的讨论: http://maven.40175.n5.nabble.com/Maven-3-maven-repositories-and-lastUpdated-td4927537.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-02-02
        • 2014-04-21
        • 2015-02-03
        • 2014-04-20
        • 2015-01-23
        • 1970-01-01
        • 2017-03-08
        相关资源
        最近更新 更多