FAILURE:由于在构建RxJava时无法下载工件,构建失败并出现异常

时间:2014-03-11 22:36:07

标签: gradle rx-java

构建RxJava项目失败的原因可能是以下异常?

jacek:~/oss/RxJava
$ ./gradlew build -x test
...
:rxjava-contrib:rxjava-android:compileJava
Download http://repo1.maven.org/maven2/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.pom
Download http://repo1.maven.org/maven2/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':rxjava-contrib:rxjava-android:provided'.
> Could not download artifact 'org.apache.maven:maven-error-diagnostics:2.2.1@jar'
   > Artifact 'org.apache.maven:maven-error-diagnostics:2.2.1@jar' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 48.057 secs

2 个答案:

答案 0 :(得分:1)

当您看到错误时,您~/.m2/repository最有可能包含部分解决的依赖关系(在这种情况下,它是org.apache.maven:maven-error-diagnostics:2.2.1@jar):

$ ls ~/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/
_maven.repositories                     maven-error-diagnostics-2.2.1.pom       maven-error-diagnostics-2.2.1.pom.sha1

只需从~/.m2/repository ...

中删除相关性目录
$ rm -rf ~/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/

...并重新运行构建。它现在应该建立良好。

jacek:~/oss/RxJava
$ ./gradlew build -x test
...
:rxjava-contrib:rxjava-swing:build

BUILD SUCCESSFUL

Total time: 1 mins 48.046 secs

答案 1 :(得分:0)

看起来您的本地maven缓存已损坏。 清洁如下:

rm -rf ~/.m2