Is ehcache transitive dependency resolution broken in mavenCentral()?

I’m trying to add the following dependency to my project (using mavenCentral()):

compile 'net.sf.ehcache:ehcache:2.7.0'

But when I run gradle build I get the following output:

What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve net.sf.ehcache:ehcache:2.7.0.
  Required by:
      myproject:0.1
   > Could not find net.sf.ehcache:ehcache-root:2.7.0.
   > Could not find net.sf.ehcache:ehcache-root:2.7.0.
   > Could not find net.sf.ehcache:ehcache-root:2.7.0.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED

Can anyone else confirm this? 99% of the time dependencies in mavenCentral() “just work” for me, so this is really weird.

The ‘ehcache-2.7.0’ POM declares ‘ehcache-root’ as its parent, and according to http://search.maven.org, the latter is not in Maven Central. So yes, the latest ‘ehcache’ POM seems broken. Earlier versions referenced ‘ehcache-parent’, which is available from Central.

I created 2 simple projects, one maven and the other gradle. Maven resolves the dependency, while gradle does not. Here is the code: https://gist.github.com/joemccall86/5154507

Maybe Maven ignores the missing parent POM, maybe due to the ‘relativePath’ element. Still doesn’t look right to me. Usually, Gradle makes it easy to work around such problems, but in the case of a missing parent POM I’m not 100% sure. A good first attempt is ‘‘net.sf.ehcache:ehcache:2.7.0@jar’’ and specifying any transitive dependencies manually.

Cool. If you dont mind, could you point me in the right direction?

See my updated comment above.

I think I got it.

compile('net.sf.ehcache:ehcache:2.7.0') { exclude module: 'ehcache-root' }

If that works for parent POMs, it’s a good solution. You can also exclude ‘ehcache-root’ globally: ‘configurations.all*.exclude module: “ehcache-root”’.