Using EclipseLink with Maven
The EclipseLink/Maven wiki page of the EclipseLink project has information on how to setup your Maven dependencies in order to use EclipseLink in a Maven based project. The problem with that page is that it contains typos in all artifactIds of the OSGi enabled artifacts. For example the page lists org.eclipse.peristence.jpa as the artifactId of the JPA bundle instead of org.eclipse.persistence.jpa. Below I have the code that you have to add to your pom.xml in order to use EclipseLink as a JPA provider in your project.
First include the EclipseLink repository in your Maven repositories by adding the following XML snippet.
<repositories> <repository> <id>EclipseLink</id> <url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url> </repository> </repositories>
Then add the following dependencies in the dependencies section of pom.xml
<dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.jpa</artifactId> <version>1.0.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.core</artifactId> <version>1.0.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.asm</artifactId> <version>1.0.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.antlr</artifactId> <version>1.0.1</version> <scope>runtime</scope> </dependency>
Remember that the above dependencies are for using EclipseLink as a JPA provider. You might also need to include the MOXY or the SDO bundle if you want to use XML mapping or SDO. Also if you want to use EclipseLink’s JPA extensions in your code (like the @Cache annotation for example) change the scope of the org.eclipse.persistence.jpa artifact from runtime to compile.