Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException when xsd with <jaxb:globalBindings optionalProperty="primitive"> element #26

Open
Andrey-Metelyov opened this issue Aug 4, 2022 · 0 comments

Comments

@Andrey-Metelyov
Copy link

Excution failed:

Execution failed for task ':xjc'.
> A failure occurred while executing com.github.bjornvester.xjc.XjcWorker
   > java.lang.NullPointerException (no error message)

When compiling xsd:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:tns="http://unbroken-dome.org/gradle-xjc-plugin/samples/books"
            xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
            jaxb:version="3.0"
            targetNamespace="http://unbroken-dome.org/gradle-xjc-plugin/samples/books">

  <xsd:annotation>
    <xsd:appinfo>
<!--      <jaxb:globalBindings>-->
      <jaxb:globalBindings optionalProperty="primitive">
        <jaxb:serializable/>
      </jaxb:globalBindings>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:complexType name="bookType">
    <xsd:attribute name="title" type="xsd:string"/>
    <xsd:attribute name="author" type="xsd:string"/>
    <xsd:attribute name="bestseller" type="xsd:boolean"/>
    <xsd:attribute name="publicationYear" type="xsd:gYear"/>
  </xsd:complexType>

  <xsd:element name="book" type="tns:bookType"/>

  <xsd:complexType name="booksType">
    <xsd:sequence>
      <xsd:element ref="tns:book"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="books" type="tns:booksType"/>
</xsd:schema>

build.gradle:

plugins {
  id('java-library')
  id('com.github.bjornvester.xjc') version '1.6.0'
}
repositories {
  mavenCentral()
}

dependencies {
  xjc "org.glassfish.jaxb:jaxb-runtime:3.0.2"
  xjc 'org.glassfish.jaxb:jaxb-xjc:3.0.1'
  xjc 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
  xjc 'jakarta.annotation:jakarta.annotation-api:2.0.0'
  xjc 'jakarta.activation:jakarta.activation-api:2.0.1'
}

xjc {
  xjcVersion.set("3.0.0")
  xsdDir.set(layout.projectDirectory.dir("src/main/schema"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant