Tuesday 15 February 2011

IntelliJ bindingDirectory for jaxb-maven-plugin -


I want to add global bindings to my schema.xsd generated types, in a separate schema.xjb binding file. I'm using IntelliJ and I'm not sure that these problems are doing this example as expected in the maven or intellij (for example eclipse). The error I get is:

  org.xml.sax.SAXParseException; SystemId: File: / D: / Projects / Location / Subject / Project / SRC / Main / Resources / xsd / schema.xsd; Line number: 7; Column number: 10; Seller Extension Binding (jaxb: extensionBindingPrefixes) is not allowed in strict mode. Experiment-extension   

Here is the element created in my pom.xml:

   & Lt; Version & gt; 1.5 & lt; / Edition & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; Step & gt; Generating sources & lt; / Step & gt; & Lt; Goals & gt; & Lt; Goal & gt; Xjc & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; Configuration & gt; & Lt ;! - The name of your generated source package - & gt; & Lt; PackageName & gt; Com.my.model.example & lt; / PackageName & gt; & Lt; SchemaDirectory & gt; $ {Project.basedir} / src / main / resources / XSD & lt; / SchemaDirectory & gt; & Lt ;! - Well intellij works badly when it comes down to binding files, so there is that - & gt; & Lt; BindingDirectory & gt; $ {Project.basedir} / src / main / resources / xjb & lt; / BindingDirectory & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt; & Lt; / Plugins & gt; & Lt; / Create & gt;   

Here is my schema located in / src / main / resources / xsd:

  & lt; Xs: schema xmlns: xs = "http: //www.w3.org/2001/XMLSchema" id = "sample schema" targetNamespace = "http://sample.com/namespace" elementFormDefault = "qualified" xmlns = " Http://sample.com/namespace "& gt; & Lt; Xs: element name = "example" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "name" type = "xs: string" maxOccurs = "unbounded" /> & Lt; Xs: element name = "road" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt;   

Here my binding file is located in / src / main / resources / xjb

  and jtb: bindings xmlns: jxb = "http: // java .sun.com / xml / ns / jaxb "xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xmlns: xjc =" http://java.sun.com/xml/ns / Jaxb / xjc "version =" 2.0 "xsi: schema location =" ../xsd / schema.xsd "& gt; & Lt; Jxb: globalBindings & gt; & Lt; Xjc: simple / & gt; & Lt; / Jxb: globalBindings & gt; & Lt; / Jxb: binding & gt;   

Any hints how great this would be to solve!

OK guys I found out what the problem is. Send me your & lt; Configuration & gt; element in pom.xml in a & lt; Extensions & gt; element is missing! Like:

  & lt; Configuration & gt; & Lt; PackageName & gt; Com.my.model.example & lt; / PackageName & gt; & Lt; SchemaDirectory & gt; $ {Project.basedir} / src / main / resources / XSD & lt; / SchemaDirectory & gt; & Lt; BindingDirectory & gt; $ {Project.basedir} / src / main / resources / xjb & lt; / BindingDirectory & gt; & Lt ;! - Tada! - & gt; & Lt; Expansion & gt; True & lt; / Extension & gt; & Lt; / Configuration & gt;    

No comments:

Post a Comment