users@jaxb.java.net

Re: Need example (pom.xml) of how to use JAXB with maven plugins (nothing works as documented)

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 9 Dec 2008 20:32:57 +0100

Although I'd rather not kindle the flame of your indignation, I feel
compelled to point out that JAXB is not concerned with deriving an XML
schema from an XML file sample. (Such a step is akin to deriving an English
Grammar from Milne's *"*Winnie-the-Pooh*" *or* *Joyce's "Ulysses" or last
Saturday's "Wahinton Post".)

Seeing your other post, I cut this short.


On Tue, Dec 9, 2008 at 7:14 PM, Cheap Lisa <ssourcetek_at_gmail.com> wrote:

> Can anyone send me (or post) or point to me a document that will show me
> how to
> generate an XSD from XML and from there Java objects using JAXB maven
> plugins?
>
> better yet, simply a pom.xml configured that works.
>
> A POM that
> 1. has a working repo configured with the latest jaxb-api
> 2. has a working plugin repo for the latest maven plugins
> 3. has targets such that all I have to do is "mvn compile install"
> and my xml files will get an xsd generated and then the java objects
> into the package of my choice (under target/)
>
>
> --- More Info - Please read:
>
> I have an XML file and want to use Jaxb to generate an XSD and then the
> java objects
> for use in my project.
>
> I am using maven so also want to use the maven plugin.
>
> ---
> Background:
>
> I google on how to do this, come across a Maven xjc plugin but that page is
> not
> documented on how to configure a pom.xml or how to use it so I hit a dead
> end.
> this page is not documented:
> http://mojo.codehaus.org/xjc-maven-plugin/index.html
>
> I keep searching and come across this page:
> https://jaxb.dev.java.net/jaxb-maven2-plugin/
> and cut and paste, but the information seems out of date there as well.
> When I follow the instructions here I get:
> org.apache.maven.lifecycle.LifecycleExecutionException: The plugin
> 'com.sun.tools.xjc.maven2:maven-j
> axb-plugin' does not exist or no valid version could be found
>
> ---
> Another document points me to this repo:
> http://download.java.net/maven/2/javax/xml/bind/jaxb-api/
> but there are only JaxB 1.x jars there.
> ---
> With so many hits in the search engine, all I find are docs that indicate
> this (xml to xsd to java objects) is possible with JaxB plugins, but
> provide no examples and the examples that I do find simply do not work
> because
> of out of date links or very old libraries still there in the maven repo's.
>
> The last link led me to this mailing list (there are no instructions to
> subscribe like usual
> but I was able to do this).
>
> ---
> Does anyone have a document that will show what I need to do:
> 1. Generate an XSD from XML (a maven target)
> 2 Generate Java objects from the XSD (a maven target)
> Included what I need is a configured pom.xml that will point to a plugin
> repo
> where I can get the latest plugins
> and also a repo where I can get the latest JaXB api's (.jars)
> I have already spent eight hours following instructions on the various
> documents
> that have popped up as a result of a google search and when I run maven
> something
> breaks. Many repo's and other things have changed but the document is
> still out
> there.
>
> I would appreciate some help. What I want to do is typical and simple but
> it seems
> extremely difficult to find instructions. I realize that the code is open
> source but
> it would take 720 hours to go through all the source code and experiment
> with different
> things to make it work.
>
> Are there up to date instructions anywhere or can someone simply send me
> their pom.xml file
> (simple) with instructions on which targets to type (like xjc:xjc - if
> needed).
>
> thanks
>
>
> Lisa Santos
>