The final solution is very simple. But when you get on a wrong track at the beginning, you end up in a terrible maze...
So here the most important hint:
The JBoss repository (http://repository.jboss.org/maven2/) is quite a mess.
In the root of the repository you find directories (matching Maven GroupIds) for
hibernate
, hibernate-annotations
and hibernate-entitymanager
.
Do not use them!
They are outdated, do not provide current versions and most annoying do not declare their dependencies... so your pom will get a mess.
All dependencies should use the GroupId
org.hibernate
(browse into the org
directory in the Maven repository).
So here is my working pom.xml:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>domain</groupId> <artifactId>cascaded-locking</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>cascaded-locking</name> <url>http://maven.apache.org</url> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> <version>10.3.2.1</version> <scope>test</scope> </dependency> </dependencies> <repositories> <repository> <id>jboss</id> <url>http://repository.jboss.org/maven2</url> </repository> </repositories> </project>
Jonas, thanks - you have probably saved a lot of people hours and hours of wasted time. I feel that Maven lacks a deprecation mechanism that would make it obvious to everyone that they're using something out of date. The problem is that once an artifact has been published it is never supposed to change thereafter. But it shouldn't be impossible to devise a mechanism for adding deprecation and redirection to the associated metadata.
ReplyDeleteI think this is so important that I've made a reference to it in a new Maven issue - see http://jira.codehaus.org/browse/MNG-3952
ReplyDeleteI'm pleased to say that Brett Porter has scheduled my suggested Maven improvement for Release 3.
ReplyDeleteYes thank you very very much !!
ReplyDeleteI fight a day to found your solution !