users@jaxb2-commons.java.net

Re: [namespace-prefix] XJC Plugin causes ClassCastException

From: Luc <useyour.mind_at_gmail.com>
Date: Mon, 20 Aug 2012 08:53:27 +0200

Hello,

Ok, I didn't understand that you were trying to compile the plugin itself
> :-)


In fact, no, I'm not trying to build the plugin itself. But as I could not
find in a .jar release, I had to build it.

The problem, as I've found now, is that Ant task
com.sun.tools.xjc.XJCTask doesn't
work as expected, because using the plugin .jar that you provided, and the
command line xjc.bat (from JAXB-2.1.13), works as expected.
So I'll invoke the main XJC class from the Ant, and I'll "rethrow" the
question (I'l try to do it correctly) to the JAXB mailing list.

Thanks again!

P.S.: Yes, I'm subscribed :)
--
Lucas
2012/8/17 <manuel.siggen_at_vd.ch>
> Luc <useyour.mind_at_gmail.com> a écrit sur 17.08.2012 12:52:09 :
>
> >
> >> What is your context ? Are you using the plugin with ant (or with
> >> some Eclipse plugin) ?
> >>
> >> The thread you linked above points to some classloader problem, so I
> >> suspect the context of what your trying to do is important.
> >
> > I've downloaded namespace-prefix project source code, via anonymous
> > SVN. Then executed mvn compile jar:jar, which generates jaxb2-
> > namespace-prefix-1.2-SNAPSHOT.jar.
> > In my project, I use the XJC Ant Task in the following target:
> >
> > <target name="generate-sources">
> >   <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
> >     <classpath>
> >       <fileset dir="${jaxb.dir}" includes="*.jar" />
> >       <fileset dir="${namespace-prefix.dir}" includes="jaxb2-
> > namespace-prefix-1.2-SNAPSHOT.jar" />
> >     </classpath>
> >   </taskdef>
> >   <xjc destdir="${build.sources.dir}" catalog="${src.resources.dir}/
> > catalog/catalog.xml">
> >     <schema dir="${src.resources.dir}/schema" includes="saml-schema-
> > protocol-2.0.xsd" />
> >     <binding dir="${src.resources.dir}/xjb" includes="saml-bindings.xjb"
> />
> >     <arg value="-extension" />
> >     <arg value="-Xnamespace-prefix" />
> >   </xjc>
> > </target>
> >
> > Where ${namespace-prefix.dir} to the previous generated .jar dir, and
> > ${jaxb.dir} points to JAXB-2.1.13, but also tested with 2.2.6.
> > Later, I execute in a Windows command line: ant generate-sources -v,
> > and fails. Also I execute in Eclipse, and fails in the same way. Ant
> > version is:
> > Apache Ant version 1.8.1 compiled on April 30 2010
> >
> > I don't know if I leave some more context information.
> >
> > I could test if works with the maven-jaxb2-plugin, but I can't
> > change Ant script for the Maven one.
>
> Ok, I didn't understand that you were trying to compile the plugin itself
> :-)
>
> I'm not sure what the 'mvn compile jar:jar' command do, as I've never used
> it myself. I usually simple issue a 'mvn clean install' command to build
> the plugin, which will generate the jar and source archive into the local
> maven repo
> (~/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-namespace-prefix/).
>
> On the other hand, the pre-compiled jar (and source archive) is available
> here :
> http://repo1.maven.org/maven2/org/jvnet/jaxb2_commons/jaxb2-namespace-prefix/1.1/if that what's your looking for.
>
> Let me know if it works for you.
>
> Regards,
>
>          Manuel
>
>
> ________________________________________*
> Manuel Siggen* - Ingénieur de développement logiciel
> Etat de Vaud, Département des Infrastructures et des Ressources Humaines
> (DIRH)
> Direction des Systèmes d'Information (DSI)
> Pôle Référentiels
> Avenue de Longemalle 1, CH-1020 Renens
> Tel:+41 (0)21 316 26 43 Fax:+41 (0)21 316 27 26 *
> **manuel.siggen@vd.ch* <manuel.siggen@vd.ch> - *www.vd.ch*<http://www.vd.ch/>
>