Search code examples
maven-2ehcachesonatype

where is the correct and recent ehcache maven repository


I've been struggling to get ehcache 2.1.0 in my environment. Anytime I thought I got it right, it's just not downloading it. Here is where I set the repository:

 <repository>
 <!--<url>https://oss.sonatype.org/content/repositories/releases/</url>-->
     <url>http://oss.sonatype.org/content/repositories/sourceforge-releases</url>
     <id>sonatype-mirror</id>
     <layout>default</layout>
     <name>Repository for library including ehcache recent ones</name>
 </repository>

And I add the dependency this way :

<dependency>
  <groupId>net.sf.ehcache</groupId>
  <artifactId>ehcache</artifactId>
  <version>2.1.0</version>
</dependency>

Is there anything that's i'm doing wrong or not properly?


Solution

  • Ehcache is available in the maven central repository, there is no need to add a particular repository.

    However, the ehcache artifact is special, it's an "aggregating" artifact which is of type pom. So the dependency should be declared like this:

    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>2.1.0</version>
      <type>pom</type>
    </dependency>
    

    Of course, you can also declare dependencies on individual modules if you want (e.g. ehcache-core) in which case you don't need to specify the type.

    References