Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suddenly "Could not resolve all dependencies...'org.apache.james:apache-mime4j:0.6@jar' not found

Tags:

gradle

I'm new to gradle, but the build of the project I'm on has been working pretty much on its own for months. Today I try to "gradle" it and I get a rather mysterious error...

bobk-mbp:DM_Server bobk$ gradle
:clean
:readme
:compileJava

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Artifact 'org.apache.james:apache-mime4j:0.6@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: 7.114 secs

The thing is I don't have any explicit dependency on org.apache.james:apache-mime4j in my dependencies section, so it must be coming in on something else. How do I figure out which of my dependencies actually needs this and then, how do I overcome or work around this missing artifact?

like image 965
Bob Kuhar Avatar asked Jun 12 '12 17:06

Bob Kuhar


1 Answers

Well that was fun. The gradle equivalent of maven's dependency:tree is

gradle dependencies
compile - Classpath for compiling the main sources.
+--- com.google.guava:guava:11.0.2 [default]
|    \--- com.google.code.findbugs:jsr305:1.3.9 [compile,master,runtime]
...
+--- org.jboss.resteasy:resteasy-multipart-provider:2.3.0.GA [default]
|    +--- javax.mail:mail:1.4.4 [compile,master,runtime]
|    |    \--- javax.activation:activation:1.1 [compile,master,runtime]
|    +--- org.apache.james:apache-mime4j:0.6 [compile,master,runtime]

This revealed my james dependency is coming in via resteasy. This knowledge alone was not helpful. It seems that my local cache has gone bad. Nuking the local m2 cache (~/.m2) solved the problem (I started out rm -rf one package at a time, but that got old quickly).

rm -rf ~/.m2

Apparently there is much I need to learn about this infrastructure. I am sure there is a better way to do this.

like image 50
Bob Kuhar Avatar answered Sep 24 '22 18:09

Bob Kuhar