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?
Local – Folder location on the local Dev machine Central – Repository provided by Maven community Let's now focus on the local repository. 2. The Local Repository The local repository of Maven is a directory on the local machine, where all the project artifacts are stored.
Basically, all Maven is telling you is that certain dependencies in your project are not available in the central maven repository. The default is to look in your local.m2 folder (local repository), and then any configured repositories in your POM, and then the central maven repository. Look at the repositories section of the Maven reference.
The default is to look in your local .m2 folder (local repository), and then any configured repositories in your POM, and then the central maven repository. Look at the repositories section of the Maven reference.
When a Maven build is executed, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named .m2.
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.
net.sf.ehcache:ehcache:2.1.0
is a dependency of type pom
therefore you need to specify it:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.1.0</version>
<type>pom</type>
</dependency>
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With