I am new to Maven and am trying to set up one of my first POM
s. My application will cache using EhCache. Going to Maven Central Repo (link here) I copy-n-pasted the <dependency>
tag and copy it into my pom.xml
like so:
...many dependencies above this point
<dependency>
<scope>compile</scope>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>
...many dependencies below this point
When I save the changes, Eclipse builds the workspace and gives me an error on the opening <dependency>
tag for EhCache 2.5:
Missing artifact net.sf.ehcache:ehcache:jar:2.5.0
So I figured that perhaps v.2.5.0 has something wrong with it, and repeated the same for 2.4.7
(the last 2.4.x
release before 2.5.0
). Same deal.
Since I'm so new to Maven, I don't even know where to begin looking. I tried Project >> Clean
and even restarted Eclipse to see if it was just a typical Eclipse "quirk". Nope.
I am thinking:
- Could EhCache be publishing bad JARs to the Maven repo?
- Could Maven Repo have something wrong with it?
- Could this be due to something else configured wrong in my
pom.xml
? - Could this be a "JAR hell" issue where I have a conflict somewhere on my dependency graph?
How would SO start tackling this problem? Thanks in advance!
They use
ehcache-core
in the official documentation. Maven Central does not have a jar artifact forehcache
2.5 which explains your error message.Using
ehcache-core
changes the dependency to:Which successfully downloads on my machine (
ehcache
does not).It is usually safer to refer to search.maven.org. Dependency from there:
Mind type pom. From module's pom:
Aparently when someone does not need terracotta, ehcache-core will do perfectly fine as other answer states.
I dropped this into IntelliJ and it found it. I suspect there is something wrong with your settings. Try creating a project with only this dependency in it. If it fails to download, I would check your setting. e.g.
.m2/settings.xml
Are you using a Nexus server or maven proxy/cache?BTW: A simpler way to search for JARs is to use http://mvnrepository.com/ which will find all the available versions and show you the XML you need to add.