Jacek Laskowski
Jacek Laskowski

Reputation: 74729

FAILURE: Build failed with an exception due to Could not download artifact when building RxJava

What might be the reason for the build of RxJava project failing with the following exception?

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

Upvotes: 1

Views: 1813

Answers (2)

Feng Dai
Feng Dai

Reputation: 633

Looks like your local maven cache is corrupted. Clean it as below:

rm -rf ~/.m2

Upvotes: 0

Jacek Laskowski
Jacek Laskowski

Reputation: 74729

When you see the error, it's most likely that your ~/.m2/repository contains partially-resolved dependency (in this case, it's 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

Just remove the directory of the dependency from the ~/.m2/repository...

$ rm -rf ~/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/

...and re-run the build. It should now build fine.

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

BUILD SUCCESSFUL

Total time: 1 mins 48.046 secs

Upvotes: 1

Related Questions