tags:

views:

167

answers:

3

Building with maven I get "package javax.xml.bind.annotation does not exist"

What do I need to make JAXB work with Java 5?

+1  A: 

Hi, Jaxb should work with Java 5 but it seems that there are more people having issues with it. Could it be that are missing some jars?

Check out this forum post.

jakob
+3  A: 

You can download the reference implementation (RI) from http://jaxb.dev.java.net/.

I can't advise you on how to make it work with maven though - more trouble than it's worth, if you ask me.

Java6 included a slightly modified version of the RI, but the RI itself works just fine with Java5.

skaffman
You can also download other JAXB implementations such as EclipseLink JAXB (MOXY) - http://www.eclipse.org/eclipselink/moxy.php
Blaise Doughan
A: 

It seems there are many versions and differing paths the get JAXB from a maven repository.

My best guess for the correct artefact is javax.xml.bind:jaxb-api:2.2

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2</version>
    <scope>compile</scope>
</dependency>
Geoff