Maven下载jar但后来报告“无法解析依赖关系”

时间:2016-06-21 20:26:43

标签: maven build-dependencies

我将pom.xml中的版本依赖关系更新为:

    <dependency>
        <groupId>com.twelvemonkeys.imageio</groupId>
        <artifactId>imageio</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>com.twelvemonkeys.imageio</groupId>
        <artifactId>imageio-jpeg</artifactId>
        <version>3.2.1</version>
    </dependency>

运行时

     mvn package

我们看到正在下载新版本:

[INFO] ------------------------------------------------------------------------
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.pom
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.pom (2 KB at 8.0 KB/sec)
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.pom
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.pom (1004 B at 22.3 KB/sec)
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.pom
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.pom (974 B at 20.7 KB/sec)
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.jar
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.jar
Downloading: https://repository.apache.org/content/repositories/snapshots/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.jar
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.jar
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.jar
Downloading: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.jar
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-jpeg/3.2.1/imageio-jpeg-3.2.1.jar (58 KB at 145.8 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-core/3.2.1/imageio-core-3.2.1.jar (64 KB at 152.0 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/com/twelvemonkeys/imageio/imageio-metadata/3.2.1/imageio-metadata-3.2.1.jar (72 KB at 171.7 KB/sec)

然而package目标仍然失败.. 无法解析其中一个相同的依赖关系(imageio.jar:3.2.1)?

  

[INFO]   -------------------------------------------------- ---------------------- [INFO] BUILD FAILURE [INFO]   -------------------------------------------------- ---------------------- [INFO]总时间:2.911 s [INFO]完成于:   2016-06-21T13:21:39-07:00 [INFO]最终记忆:17M / 221M [INFO]   -------------------------------------------------- ---------------------- [错误]无法在项目sparknet上执行目标:无法解决   项目org.amplab的依赖项:sparknet:jar:1.0:找不到   com.twelvemonkeys.imageio:imageio:jar:3.2.1 in   https://repository.apache.org/content/repositories/snapshots是   缓存在本地存储库中,不会重新尝试解析   直到Maven快照存储库的更新间隔已经过去或   强制更新 - &gt; [帮助1] [错误]

2 个答案:

答案 0 :(得分:0)

您需要使用-U来强制maven忽略本地存储库中的缓存工件并更新它们。 mvn package -U

答案 1 :(得分:0)

问题似乎是3.1.23.2.1 imagio版本的imageio-core他们重组了他们的模块。现在他们有imageio而不是<dependency> <groupId>com.twelvemonkeys.imageio</groupId> <artifactId>imageio-core</artifactId> <version>3.2.1</version> </dependency>

所以..更新pom.xml如下:

  

imageio-core

(使用imageio代替$.ajax({ type: 'GET', url: "https://DOMAINNAME.com", contentType: "application/json", dataType: 'jsonp', success: function(data) { console.log(data) }, error: function(e) { console.log(e.message); } }); )似乎已经解决了它。