Coder Social home page Coder Social logo

gradle-jaxb-plugin's Introduction

gradle-jaxb-plugin

Build Status

Download

💥 💥

❗IMPORTANT PLUGIN ID CHANGES❗

In compliance with the gradle plugin submission guidelines, this plugin's id is now fully qualified.

It changed from jaxb to com.github.jacobono.jaxb. This affects how you apply the plugin (apply plugin: 'com.github.jacobono.jaxb')

💥 💥

Gradle plugin that defines some conventions for xsd projects and provides some processing to ease some of the maintenance of these projects by:

  • Hooking in ant tasks to parse the xsd with the xjc task.
  • Generates code from xsds per unique namespace.
  • Generates an xsd dependency tree, to parse namespaces in their order of dependencies, from the base namespaces up.
  • Generating an episode file for every unique namespace in a set of xsd files
  • Defining a convention to place generated episode files
  • Ability to define xsd projects to depend on one another, so that when parsing, what a project depends on is also parsed

Using The Plugin

💥 💥

Now in the gradle plugins repo

💥 💥

new group id com.github.jacobono matches gradle plugin id.

💥 💥

Using Gradle 2.1 plugins script block

plugins {
    id 'com.github.jacobono.jaxb' version '1.3.6'
}

Using Straight-Up JCenter

buildscript {
  repositories {
    jcenter()
    mavenCentral()
  }

  dependencies {
    classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6'
  }
}

apply plugin: 'com.github.jacobono.jaxb'

Setting Up The JAXB Configurations

You need the jaxb configuration to run the xjc task, but that is the only task that has an external dependency.

Any version of jaxb that you care to use will work. I try to stay with the latest releases.

    dependencies { 
      jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
      jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
      jaxb 'javax.xml.bind:jaxb-api:2.2.7'
    }

Plugin Tasks

There are only two tasks.

  • xjc
    • runs xjc ant task on each .xsd in the dependency tree.
    • needs to be run manually.
  • xsd-dependency-tree
    • Builds a dependency tree from all .xsd files configured to be parsed.
    • Finds each unique namespace and groups files containing that namespace
    • Analyzes xsd dependencies and places them in the correct place in the dependency tree so that the namespaces can be parsed in order using their generated episode files to bind, allowing other projects to use the episode files generated from the namespace in the tree.
      • This keeps all namespaces decoupled and prevents a big episode blob containing everything that was parsed.

xjc depends on xsd-dependency-tree so you don't need to run the tree task at all.

Plugin Conventions

There are two conventions that can be overridden and one is nested in the other.

The jaxb convention defines the conventions for the whole plugin, and the xjc convention defines the conventions for the xjc ant task.

You can change these defaults with a closure in your build script.

    jaxb {
	  ...
      xjc {
	    ...
	  }
    }

JAXB Plugin Convention

There are 4 overrideable defaults for this JAXB Plugin. These defaults are changed via the jaxb closure.

  • xsdDir
    • ALWAYS relative to project.rootDir
      • Defined by each project to tell the plugin where to find the .xsd files to parse
  • episodesDir
    • ALWAYS relative to project.rootDir
      • i.e. "episodes", "schema/episodes", "xsd/episodes", "XMLSchema/episodes"
      • All generated episode files go directly under here, no subfolders.
  • bindingsDir
    • ALWAYS relative to project.rootDir
      • i.e. "bindings", "schema/bindings", "xsd/bindings", "XMLSchema/bindings"
      • User defined binding files to pass in to the xjc task
      • All files are directly under this folder, no subfolders.
  • bindings
    • customization files to bind with
    • file name List of strings found in bindingsDir
    • if there are bindings present, xjc will be called once with the glob pattern **/*.xsd to snag everything under xsdDir. Fixes #27.

XJC Convention

These defaults are changed via the nested xjc closure. Several sensible defaults are defined to be passed into the wsimport task:

parameter Description default type
destinationDir (R) generated code will be written to this directory src/main/java String
extension (O) Run XJC compiler in extension mode true boolean
header (O) generates a header in each generated file true boolean
producesDir (O)(NI) aids with XJC up-to-date check src/main/java String
generatePackage (O) specify a package to generate to none String
args (O) List of strings for extra arguments to pass that aren't listed none List<String>
removeOldOutput (O) Only used with nested <produces> elements, when 'yes' all files are deleted before XJC is run 'yes' String
taskClassname (O) Enables a custom task classname if using something other than jaxb com.sun.tools.xjc.XJCTask String
  • (O) - optional argument
  • (R) - required argument
  • (NI) - not implemented / not working

For more in depth description please see https://jaxb.java.net/2.2.7/docs/ch04.html#tools-xjc-ant-task -- or substitute the version you are using.

destinationDir

destinationDir is relative to project.projectDir. It is defaulted to src/main/java, but can be set to anywhere in project.projectDir.

producesDir

producesDir is not currently used in the plugin. But it was meant to be in there so that if no xsd changes have happened, then no code generation would take place. Hasn't worked yet.

taskClassname

taskClassname is the class to be used to run the xjc task. Useful if JAXB2 is desired to be used.

Extra Arguments

args passes arbitrary arguments to the xjc ant task. This is useful when activating JAXB2 plugins.

Examples

Default Example using JAXB

If the default conventions aren't changed, the only thing to configure (per project) is the xsdDir, and jaxb dependencies as described above.

jaxb {
  xsdDir = "schema/folder1"
}

Default Example using JAXB2

Customized to use the same xjc task that xjc-mojo uses.

dependencies {
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:0.6.4"
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.4"
}

jaxb {
  xsdDir = "some/folder"
  xjc {
     taskClassname      = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
	 generatePackage    = "com.company.example"
     args               = ["-Xinheritance", "-Xannotate"]
  }
}

Defining The Plugin For All Projects

I like to create a convention for xsd projects to have a suffix of -schema. I find it easy to then write:

subproject { project ->
  if(project.name.endsWith("-schema")) { 
    apply plugin: 'com.github.jacobono.jaxb'

    dependencies { 
      jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
      jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
      jaxb 'javax.xml.bind:jaxb-api:2.2.7'
    }
  }
}

applying the plugin to all schema projects.

Other Features

Depend On Another Project

This lets gradle know that the xjc task of a project is dependent on the xjc task of another project. This can be achieved with:

dependencies {
  jaxb project(path: ':common', configuration: 'jaxb')
}

I like how this expresses that xsd's definitely depend on other xsd's outside of their parent folder xsdDir.

This will run the xjc task on common before running the xjc task of of the project this is defined in.

Examples

You can find some examples in the examples folder

Improvements

If you think this plugin could be better, please fork it! If you have an idea that would make something a little easier, I'd love to hear about it.

gradle-jaxb-plugin's People

Contributors

fbaro avatar ljacomet avatar scubacabra avatar valdisrigdon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-jaxb-plugin's Issues

Multi schema modules generate unusable episode files

I have a module that has several schema files in it. Each has a different namespace and a different purpose. However when you look at the episode files, it generates one per module name and not one per schema. This results in requiring all the schema's in the module be imported in the schema file if it needs any of them. If you don't you get the following error: [ant:xjc} [ERROR] SCD "x-schema::tns" didnt match any schema component.

Not sure why episode files are done at the module level in the first place, but at a minimum and option to generate an episode file per schema would be nice to fix this issue.

Class not generated

the following element:

<xs:element name="SomeClass" type="SomeClassType">
        <xs:annotation>
            <xs:appinfo>
                <meta:content-type>
                    application/xml;application/json;class=com.example
                </meta:content-type>
            </xs:appinfo>
            <xs:documentation source="since">5.7</xs:documentation>
            <xs:documentation xml:lang="en">
                ...
            </xs:documentation>
        </xs:annotation>
    </xs:element>

generates a SomeClass.java file when I use the maven plugin:

<plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.11.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>src/main/resources/schema</schemaDirectory>
            </configuration>
        </plugin>

But does not when I use this one:

jaxb {
    xsdDir = "${projectDir.path - rootDir.path}/src/main/resources/schema"
    episodesDir = "${buildDir.path - rootDir.path}/schema/episodes"
    xjc {
        destinationDir = jaxbDstDir
        producesDir = jaxbDstDir
    }
}

with:

  jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
  jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
  jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'

the dependencies are the same as the maven plugin is using,
other classes are generated okay
I use the 1.3.6 version

thanks

Consider publishing to Maven Central, JCenter or plugins.gradle.org

Great plugin, thanks very much for making it available. There is one annoyance, though.

We try to store all dependencies in a local Artifactory instance, which is set up to mirror Maven Central, JCenter and a few other major repos out there. As this plugin doesn't publish to those, I have several options, none of which are very appealing:

  • Leave the custom repo url in the build file and have the plugin downloaded directly by each user, rather than being cached
  • Add a cached repo in artifactory just for this plugin. This starts to suck after a while if every single dependency that you need requires having to create a separate cached repo
  • Download the plugin and upload it to artifactory manually every time a new version comes out

I think publishing to JCenter is a bit less cumbersome than publishing to Maven Central, and if you add it to plugins.gradle.org with Gradle 2.1+ we can even access it directly by its plugin id. Either of those would make our lives a fair bit easier.

Can you please consider publishing your plugin to:

This for easier access to your plugin.
This way we don't have to add your specific bintray repo to artifactory in our organisation but just can keep working on jcenter and gradle plugins.

Thanks

Binding file *.xjb not getting recognized

Hi,
I was trying out this plugin for generating out java classes out of xsd with custom binding *.xjb file.
jaxb { xsdDir = "src/main/resources/schema/" bindings = ["src/main/resources/schema/bindings/discovery-bindings.xjb"] xjc { taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task" generatePackage = "com.nacnez.learn.wopiTrial.xml" args = ["-Xinheritance", "-Xannotate"] } }
When I execute the gradle xjc task it doesn't seem to be recognizing my xjb file. If I rename the filename to .xsd it seems to read the file but it throws the issue that it is not a valid xsd.

If I execute the same using xjc it works - xjc -b src/main/resources/schema/bindings/ -d src/main/java/ -p com.nacnez.learn.wopiTrial.xml src/main/resources/schema/

I have attached the relevant xsd and xbj files (changed extension as txt). Please let me know where I am going wrong.

Thanks,
~ Srini

discovery-bindings.xjb.txt
discovery.xsd.txt

How to specify specific XSDs and packages for each?

The default config and doc shows how to process all the XSDs in a folder to a particular package. How do I specify individual XSD files and a different package for each one? All of them are in the same folder.

How to configure typesafeEnumMaxMembers?

[ant:xjc] [WARNING] Simple type "TimeZoneType" was not mapped to Enum due to 
EnumMemberSizeCap limit. Facets count: 513, current limit: 256. You can use customization
attribute "typesafeEnumMaxMembers" to extend the limit.

I wasn't able to get this flag passed through, so is this my oversight or a missing capability?

ObjectFactory class is being generated wrong

Hi,

Please, I'm having trouble using the plugin (1.3.6) with Gradle 3.3 and I need help.
I had two XSD's schemas (routes.xsd and security.xsd) and after running ./gradlew xjc the ObjectFactory class that was being generated, has only some methods of only one XSD file.

routes.xsd:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.restnext.org/routes"
           xmlns="http://www.restnext.org/routes"
           elementFormDefault="qualified">

    <xs:element name="routes">
        <xs:annotation>
            <xs:appinfo>This schema defines a RestNEXT Route Metadata.</xs:appinfo>
            <xs:documentation source="description">
                This is the root element of the descriptor.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="route" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation source="description">
                            This element represents the route metadata.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:all>
                            <!-- comment this path element with regex validation
                            because this entry can be:
                            a path (/test),
                            a path param (/test/{name}) or
                            a path regex (/test/regex/\\d+).
                            And this regex only match as valid the entries: (path and path param).
                            <xs:element name="path">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the route path.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value="([/])(([/\w])+(/\{[\w]+\})*)*([?])?"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            -->
                            <xs:element name="path" type="xs:string">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the route path.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>

                            <xs:element name="provider">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the lambda string method reference route provider.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value="([\w.])*([:]{2})(\w)+"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>

                            <xs:element name="enable" type="xs:boolean" minOccurs="0" default="true">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines if this route path is enable or not.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>

                            <xs:element name="methods" minOccurs="0">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the route allowed http methods.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="method" maxOccurs="unbounded">
                                            <xs:annotation>
                                                <xs:documentation source="description">
                                                    This element defines a http method.
                                                </xs:documentation>
                                            </xs:annotation>
                                            <xs:simpleType>
                                                <xs:restriction base="xs:string">
                                                    <xs:enumeration value="GET"/>
                                                    <xs:enumeration value="POST"/>
                                                    <xs:enumeration value="PUT"/>
                                                    <xs:enumeration value="PATCH"/>
                                                    <xs:enumeration value="DELETE"/>
                                                </xs:restriction>
                                            </xs:simpleType>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>

                            <xs:element name="medias" minOccurs="0">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the route allowed media types.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="media" type="xs:string" maxOccurs="unbounded">
                                            <xs:annotation>
                                                <xs:documentation source="description">
                                                    This element defines a media type.
                                                </xs:documentation>
                                            </xs:annotation>
                                        </xs:element>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>

                        </xs:all>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.restnext.org/securities"
           xmlns="http://www.restnext.org/securities"
           elementFormDefault="qualified">

    <xs:element name="securities">
        <xs:annotation>
            <xs:appinfo>This schema defines a RestNEXT Security Metadata.</xs:appinfo>
            <xs:documentation source="description">
                This is the root element of the descriptor.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="security" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation source="description">
                            This element represents the security metadata.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:all>
                            <!-- comment this path element with regex validation
                            because this entry can be:
                            a path (/test),
                            a path param (/test/{name}) or
                            a path regex (/test/regex/\\d+).
                            And this regex only match as valid the entries: (path and path param).
                            <xs:element name="path">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the security path.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value="([/])(([/\w])+(/\{[\w]+\})*)*([?])?"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            -->
                            <xs:element name="path" type="xs:string">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the security path.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>

                            <xs:element name="provider">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines the lambda string method reference security provider.
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value="([\w.])*([:]{2})(\w)+"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>

                            <xs:element name="enable" type="xs:boolean" minOccurs="0" default="true">
                                <xs:annotation>
                                    <xs:documentation source="description">
                                        This element defines if this security path is enable or not.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>

                        </xs:all>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>

build.gradle:

description = 'restnext-core'

buildscript {
  repositories {
    jcenter()
    mavenCentral()
  }

  dependencies {
    classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6'
  }
}

apply plugin: 'com.github.jacobono.jaxb'

dependencies {
  compile project(':restnext-util')
  compile 'io.netty:netty-all'
  compile 'org.slf4j:slf4j-api'
  testCompile 'junit:junit'
  compile 'org.javassist:javassist'
  compile 'ch.qos.logback:logback-classic'
  jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
  jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
  jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
  jaxb 'javax.xml.bind:jaxb-api:2.2.12'
}

jaxb {
  xsdDir = rootProject.file('/restnext-core/src/main/resources')
  episodesDir = rootProject.file('/restnext-core/src/main/resources/META-INF')
  xjc {
    header = false
    generatePackage = 'org.restnext.core.jaxb.internal'
    args = [
        //'-no-header',
        '-enableIntrospection',
        '-npa'
    ]
  }
}

ObjectFactory class generated by (jacobono/gradle-jaxb-plugin):

package org.restnext.core.jaxb.internal;

import javax.xml.bind.annotation.XmlRegistry;


/**
 * This object contains factory methods for each 
 * Java content interface and Java element interface 
 * generated in the org.restnext.core.jaxb.internal package. 
 * <p>An ObjectFactory allows you to programatically 
 * construct new instances of the Java representation 
 * for XML content. The Java representation of XML 
 * content can consist of schema derived interfaces 
 * and classes representing the binding of schema 
 * type definitions, element declarations and model 
 * groups.  Factory methods for each of these are 
 * provided in this class.
 * 
 */
@XmlRegistry
public class ObjectFactory {


    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal
     * 
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link Securities }
     * 
     */
    public Securities createSecurities() {
        return new Securities();
    }

    /**
     * Create an instance of {@link Securities.Security }
     * 
     */
    public Securities.Security createSecuritiesSecurity() {
        return new Securities.Security();
    }

}

ObjectFactory class generated by (highsource/maven-jaxb2-plugin):

package org.restnext.core.jaxb.internal;

import javax.xml.bind.annotation.XmlRegistry;


/**
 * This object contains factory methods for each 
 * Java content interface and Java element interface 
 * generated in the org.restnext.core.jaxb.internal package. 
 * <p>An ObjectFactory allows you to programatically 
 * construct new instances of the Java representation 
 * for XML content. The Java representation of XML 
 * content can consist of schema derived interfaces 
 * and classes representing the binding of schema 
 * type definitions, element declarations and model 
 * groups.  Factory methods for each of these are 
 * provided in this class.
 * 
 */
@XmlRegistry
public class ObjectFactory {


    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal
     * 
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link Routes }
     * 
     */
    public Routes createRoutes() {
        return new Routes();
    }

    /**
     * Create an instance of {@link Securities }
     * 
     */
    public Securities createSecurities() {
        return new Securities();
    }

    /**
     * Create an instance of {@link Routes.Route }
     * 
     */
    public Routes.Route createRoutesRoute() {
        return new Routes.Route();
    }

    /**
     * Create an instance of {@link Securities.Security }
     * 
     */
    public Securities.Security createSecuritiesSecurity() {
        return new Securities.Security();
    }

    /**
     * Create an instance of {@link Routes.Route.Methods }
     * 
     */
    public Routes.Route.Methods createRoutesRouteMethods() {
        return new Routes.Route.Methods();
    }

    /**
     * Create an instance of {@link Routes.Route.Medias }
     * 
     */
    public Routes.Route.Medias createRoutesRouteMedias() {
        return new Routes.Route.Medias();
    }
}

DOCTYPE is disallowed

I am facing following exception while running the xjc task in my project.

`[Fatal Error] xmldsig-core-schema.xsd:2:10: DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
:xsd-dependency-tree FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':xsd-dependency-tree'.

org.xml.sax.SAXParseException; systemId: file://C/Users/rajveer.singh/workspace_ndc/ndc-schema/resources/schemas/15.2-schemas-edist/xmldsig-core-schema.xsd; lineNumber: 2; columnNumber: 10; DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
`

Guice-related error on Gradle 2.4

Error on ./gradlew clean build:

15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.jacobo.plugins.JaxbPlugin.class$(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.jacobo.plugins.JaxbPlugin.$get$$class$com$google$inject$Guice(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy:51)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)

Build.gradle:

    compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet-core', version: '2.15'
    compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '2.15'
    compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
    compile group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.15'
    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.2'
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.2'
    compile group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics-runtime', version: '0.9.0'
    compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.2.11'
    compile group: 'com.sun.xml.bind', name: 'jaxb-xjc', version: '2.2.11'
    compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.12'
    compile group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics', version: '0.9.2'
    jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
    jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
    jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:0.9.2"
    jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.4"
}


def generatedResources = "src/main/java"

jaxb {
    xsdDir = "src/main/xsd"
    bindingsDir = "src/main/xsd"
    bindings = ["bindings.xjb"]
    episodesDir = "build/generated-resources/main/java"
    xjc {
        destinationDir = generatedResources
        producesDir = generatedResources
        taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
    }
}

buildscript {
    repositories {
        maven {
            url "INTERNAL_NEXUS_URL"
        }
    }
    dependencies {
        classpath "org.akhikhl.gretty:gretty:1.2.2"
    }
}

apply plugin: 'org.akhikhl.gretty'

gretty {
    port = 8080
    contextPath = '/jaxb-test'
    servletContainer = 'tomcat8'
    debugPort = 5005      // default
    debugSuspend = true   // default
}

apply plugin: needed?

Is there a section that should be in the Usage section where we include "apply plugin ?" in the build.gradle file? If so can the documentation be updated?

thanks

java.lang.OutOfMemoryError: PermGen

One small xsd.
STS 3.7
--launcher.XXMaxPermSize
256M

Gradle 2.4 (external)

Errors happens once a while (since out of memory) as I have set the Gradle to Refresh at 5 seconds after change event.

> Failed to apply plugin [id 'com.github.jacobono.jaxb']
  > com.google.inject.internal.util.$ComputationException: java.lang.OutOfMemoryError: PermGen     space
buildscript {
    repositories {
        maven { url "https://repo.spring.io/libs-release" }
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        //classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.10.RELEASE")
        //####################### XJC - JDK 1.7/1.8 ####################
        classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6'
        //######################
    }
}

//apply plugin: 'java'
//:apply plugin: 'eclipse'
apply plugin: 'com.github.jacobono.jaxb'

dependencies {
    //####################### XJC - JDK 1.7/1.8 ####################
    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7'
    jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7'
    jaxb 'javax.xml.bind:jaxb-api:2.2.7'
    //######################
}

//####################### XJC - JDK 1.7/1.8 ####################

jaxb {
   xjc {
     xsdDir = "my-schema/src/main/resources"
     generatePackage = "org.example"
   }

}


sourceSets {
        main {
            java {
                srcDir 'src/main/java'
            }
        }
    }



task cleanGenerated{
    //delete 'src/main/java/org'
    //create 'src/main/java'
    //(new File('src/main/java')).mkdirs() 
}
//######################



compileJava.dependsOn xjc
clean.dependsOn cleanGenerated

Here is the stacktrace:

[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks: 
[sts]      eclipse
[sts] -----------------------------------------------------

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred evaluating root project 'shipment'.
> PermGen space

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 31.949 secs
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle installation 'C:\tools\gradle-2.4'.
    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
    at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:71)
    at org.springsource.ide.eclipse.gradle.core.TaskUtil.execute(TaskUtil.java:117)
    at org.springsource.ide.eclipse.gradle.core.launch.GradleProcess$1.doit(GradleProcess.java:92)
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:53)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred evaluating root project 'shipment'.
    at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)
    at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
    at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'shipment'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
    ... 34 more
Caused by: java.lang.OutOfMemoryError: PermGen space
    at org.gradle.plugins.ide.eclipse.EclipsePlugin.onApply(EclipsePlugin.groovy:64)
    at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy:37)
    at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
    at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
[sts] Time taken: 0 min, 35 sec
[sts] -----------------------------------------------------

Hello world example doesn't work

I just cloned the repo and tried to build the example but my gradle can't find the gradle-jaxb-plugin. Is there something missing on README?

build failes, cannot find dependency

When I run this, I get an error

> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.jacobo.gradle.plugins:gradle-jaxb-plugin:1.3.1.
     Required by: ...

The xsdDir, episodesDir and bindingsDir do not accept absolute paths

We have a build env where we need to be able to configure an absolute paths for the xsdDir, episodesDir and bindingsDir. If you attempt to do this now the plugin appends the project.rootDir to the path even if it is already absolute. Also I would argue that in the case of a relative path appending project.rootDir is actually incorrect because in a multi-project build that location is the parent project which means the path always has to be relative to the parent project's directory and not the current project's directory. It probably should be project.projectDir instead.

java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener for JAXB v2.2.11

    apply plugin: 'com.github.jacobono.jaxb'

    dependencies {
        jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
        jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
        jaxb 'javax.xml.bind:jaxb-api:2.2.11'
    }

    10:07:01.752 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Class org.xml.sax.ErrorHandler loaded from parent loader (parentFirst)
    10:07:01.762 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Resource com/sun/tools/xjc/api/ErrorListener.class loaded from ant loader
    10:07:01.782 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Couldn't load Resource com/sun/xml/bind/api/ErrorListener.class
    10:07:01.792 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':iqpdct-iodd101:xjc'
    10:07:01.802 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :iqpdct-iodd101:xjc FAILED
    10:07:01.822 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :iqpdct-iodd101:xjc (Thread[main,5,main]) completed. Took 1.972 secs.
    10:07:01.832 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 3.137 secs, idle: 0.038 secs
    10:07:01.842 [ERROR] [org.gradle.BuildExceptionReporter]
    10:07:01.852 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
    10:07:01.862 [ERROR] [org.gradle.BuildExceptionReporter]
    10:07:01.872 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
    10:07:01.882 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':iqpdct-iodd101:xjc'.
    10:07:01.892 [ERROR] [org.gradle.BuildExceptionReporter] > java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener
    10:07:01.902 [ERROR] [org.gradle.BuildExceptionReporter]
    10:07:01.912 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
    10:07:01.922 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
    10:07:01.942 [LIFECYCLE] [org.gradle.BuildResultLogger]
    10:07:01.942 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

Failing to generate java classes with multiple schemas and binding.xjb customizations

Hi,

Thanks for your very useful plugin.

I encounter this error when I launch "gradle xjc" :

/correct/path/to/foo1.xsd is not a part of this compilation. Is this a mistake for (...)

(Even with -verbose mode or --info in gradle, this is the only error message I have...)

It appends when I have two xsd schemas (linked together or not), foo1.xsd and foo2.xsd in the xsdDir and want to customize one of them (for example foo1.xsd) in a binding file.
If I delete the foo2.xsd file, java classes are generated with the relevant customization.

Here is an example of my binding file, with an inheritance customization on an element of foo1.xsd :

(bindings.xjb (in the bindingsDir folder)) :

<jxb:bindings 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"
    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jxb:extensionBindingPrefixes="xjc inheritance">

    <jxb:bindings schemaLocation="../foo1.xsd">
         <jxb:bindings node="//xs:complexType[@name='fooType']">
                 <inheritance:implements>package.foo.fooInterface</inheritance:implements>
         </jxb:bindings>
    </jxb:bindings>
</jxb:bindings>

Precision :
If I have the two xsd schemas present in the xsdDir without "<jxb:bindings schemaLocation="../foo1.xsd"></xcb:bindings>" customization tag in bindings.xjb, but instead, for example, a "<globalBindings>" tag, injecting superclass on all generated classes, the reverse engineering works perfectly, with extension of the superclass by all generated classes.
It's only the schema-binded customization that is problematic...(It seems to be a path resolution problem on schemaLocation attribute, but the xsd path which is threw on the error message is right, so...)

My gradle configuration :

def generatedResources = "build/generated-resources/main/java"
jaxb {
    xsdDir                = "src/main/resources/schemas"
    bindingsDir           = "src/main/resources/schemas/bindings"
    bindings              = ["bindings.xjb"]
    episodesDir           = "build/generated-resources/main/resources"
  xjc {
     destinationDir     = generatedResources
     producesDir        = generatedResources
     taskClassname      = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
     args               = ["-Xinheritance", "-Xannotate"]
  }
}

Thanks for your help!

Version 1.3.6 not in plugin repository

If i use the recomended method to include the plugin in my build script i get the following error:

Error:(5, 0) Plugin [id: 'com.github.jacobono.jaxb', version: '1.3.6'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Gradle Central Plugin Repository (plugin 'com.github.jacobono.jaxb' has no version '1.3.6' - see https://plugins.gradle.org/plugin/com.github.jacobono.jaxb for available versions)

https://plugins.gradle.org/plugin/com.github.jacobono.jaxb
1.3.5 seems to be the latest there.

Support DTD files

I think the plugin should be able to support DTD like the ant plugin or the maven plugin.

xsdDir cannot support subproject

my project structure is like:
Root
|-Folder 1
|--subsubproject 1

In my build.gradle I set xsdDir to /src/resources/schema.
In runtime I got error as:
Could not normalize path for file Root\src\resources\schema.

Seems the the folder and subproject name are skipped.

Java 6 compatibility

Right now, the jaxb plugin requires Gradle to be run with Java 7.
Is it possible to compile the jaxb plugin with target=1.6, so that it works even if Gradle is run with Java 6?

Unable to apply plugin

Hello,

I'm trying to use the plugin in my Gradle 2.8 project, but I get the following error:

Failed to apply plugin [id 'com.github.jacobono.jaxb']
  No such property: extensions for class: java.lang.String

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':projectname'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
    at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:72)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:153)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:499)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:86)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.github.jacobono.jaxb']
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:160)
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:112)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:35)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:79)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:135)
    at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
    at org.gradle.api.plugins.PluginAware$apply.call(Unknown Source)
    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
    at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
    at build_9a1g6pkbxdew2m120k8e1qpmb.run(/home/robert/develop/repository/nts/trost-connector/build.gradle:1)
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
    ... 58 more
Caused by: groovy.lang.MissingPropertyException: No such property: extensions for class: java.lang.String
    at org.gradle.jacobo.plugins.JaxbPlugin.configureJaxbExtension(JaxbPlugin.groovy:73)
    at org.gradle.jacobo.plugins.JaxbPlugin.this$2$configureJaxbExtension(JaxbPlugin.groovy)
    at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy:52)
    at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
    at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:44)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
    ... 69 more

Here is my build.gradle:

apply plugin: 'com.github.jacobono.jaxb'

dependencies {
    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
    jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
    jaxb 'javax.xml.bind:jaxb-api:2.2.7'
}

jaxb {
   xjc {
     xsdDir = "src/main/resources/"
     generatePackage = "test" 
   }
}

Does this have something to do with Gradle 2.8? Or am I doing something wrong here?

unresolved dependencies

I can't seem to get past this error on gradle build:

Searched in the following locations:
https://jcenter.bintray.com/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.pom
https://jcenter.bintray.com/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.jar
https://repo1.maven.org/maven2/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.pom
https://repo1.maven.org/maven2/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.jar
Required by:
:gfexpert:unspecified > org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4
:gfexpert:unspecified > org.gradle.jacobo.plugins:gradle-wsdl-plugin:1.7.6

What am I missing:

dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4' 
    classpath 'org.gradle.jacobo.plugins:gradle-wsdl-plugin:1.7.6'    
}

apply plugin: 'com.github.jacobono.jaxb'

dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
jaxb 'javax.xml.bind:jaxb-api:2.2.7'
etc

I can't get it to work for me.

Invoke "xjc" task from within a loop

Hi everyone

I already read that isn't possible to invoke xjc from within another task, but it would be very useful. I have a task that copy a lot of xsd schema inside a folder, and i would be binding into class separately with single xjc invocation. Is there a workaround to obtain this? This is my build script (I'm trying to invoke xjc task from within initBind task). Thank you
build.gradle.txt

cannot access plugin

I am trying to include the plugin 1.3.6 version using buildscript {} notation just as given in the readme (executing gradle script from IDEA). At project refreshing I get: "Error: Connection refused: connect. It is certainly not a proxy issue because the same buildscript invocation works fine for no.nils.wsdl2java plugin. I tried this too to no avail:
https://plugins.gradle.org/plugin/com.github.jacobono.jaxb

Example from readme is not working

Hi,

I have tried using 1.3.6:

jaxb {
    xsdDir = "${projectDir.path - rootDir.path}/src/main/resources/schema"
    episodesDir = "${buildDir.path - rootDir.path}/schema/episodes"
    xjc {
        taskClassname      = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
        generatePackage    = "com.example"
        args               = ["-Xinheritance", "-Xannotate"]
    }
}

and:

dependencies {
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:0.6.4"
  jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.4"
}

and I get:

Execution failed for task ':public-cloud:xjc'.
> taskdef A class needed by class org.jvnet.jaxb2_commons.xjc.XJC2Task cannot be found: com/sun/tools/xjc/XJC2Task
   using the classloader AntClassLoader[~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-ant/0.6.5/745dcb1381e32dc6d171e3299c6d1fc06728d4d6/jaxb2-basics-ant-0.6.5.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics/0.6.4/b8a0ebd9a0d9fafb19e1ebc0216f7fc85c1abb4/jaxb2-basics-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-annotate/0.6.4/9ba2ba3b83980dd71e6122bb9c3e124495beb33/jaxb2-basics-annotate-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-runtime/0.6.4/cfe61f199e352b92c63a2cce8b44df131d1bd952/jaxb2-basics-runtime-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-tools/0.6.4/d61697c4c8c9daf89a2aa35b26fa53b4b055efee/jaxb2-basics-tools-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/com.google.code.javaparser/javaparser/1.0.8/ec09ff06f6c0d69c07b48df1b725f50d37298c47/javaparser-1.0.8.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.annox/annox/0.5.0/2b2ba5f7bdb897a58febf9f26cb73818d7eba548/annox-0.5.0.jar:~/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:~/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.2/ef6449b62937bbd10e29ba9ed9a852754b861d26/commons-lang-2.2.jar:~/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar]

Jaxb-xjc 1.0.7

Hi,
I try to use the old version 1.0.7 for make jaxb 1 and I receive this error:
xjc doesn't support the "destdir" attribute

thx

Gradle JAXB detects folders as XSD dependency

Gradle JAXB detects folders as XSD dependency.

Caused by: java.io.FileNotFoundException: /home/abc/dev/projects/adcubum/ksd-server/common.config/src/main/resources/xsd (Is a directory)
at org.gradle.jacobo.schema.factory.DefaultDocumentFactory.createDocument(DefaultDocumentFactory.groovy:39)
at org.gradle.jacobo.schema.factory.DocumentFactory$createDocument$0.call(Unknown Source)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver.resolveDependencies(ExternalDependencyResolver.groovy:95)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$_resolve_closure1_closure5.doCall(ExternalDependencyResolver.groovy:70)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$_resolve_closure1.doCall(ExternalDependencyResolver.groovy:69)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver.resolve(ExternalDependencyResolver.groovy:52)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$resolve$0.call(Unknown Source)
at org.gradle.jacobo.plugins.task.JaxbDependencyTree.start(JaxbDependencyTree.groovy:57)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
... 64 more

This resolver method call retrieves a Filecollection containg directory.

If I remove the directory (using a debugger) from the collection, everything runs smooth.

Java code generation appears to fail when working with schema files that declare namespaces ending with a '#'

We are having difficulty using this plugin to generate Java code when working with schema files that declare namespaces that end with a '#'.

I am using the following version of gradle:

++++++++++++++++++++
gradle -v


Gradle 2.4

Build time: 2015-05-05 08:09:24 UTC
Build number: none
Revision: 5c9c3bc20ca1c281ac7972643f1e2d190f2c943c

Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM: 1.8.0_51 (Oracle Corporation 25.51-b03)
OS: Linux 3.13.0-63-generic amd64
+++++++++++++++++++++++++++++++++++++++

Following files have been copied to this ticket in order to reproduce the problem.

(1) build.gradle
++++++++++++++++++++
buildscript {
repositories {
jcenter()
}
}

plugins {
id "com.github.jacobono.jaxb" version "1.3.5"
}

version = '1.0'

repositories {
mavenCentral()
jcenter()
}

jaxb {
xsdDir = "schemas"
xjc {
destinationDir = "generated"
generatePackage = "schemas"
}
}

dependencies {

// This first line specifies which version of the xjc compiler to use
jaxb 'com.sun.xml.bind:jaxb-xjc:2.1.12'

}
++++++++++++++++

(2) schema_imported.xsd: Place this in path 'schemas/schema_imported.xsd' relative to 'build.gradle'

+++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++

(3) schema_importer.xsd: Place this in path 'schemas/schema_importer.xsd' relative to 'build.gradle'

++++++++++++++++++++

+++++++++++++++++++++

Things appear to work well when 'http://www.w3.org/2009/09/imported#' is replaced by 'http://www.w3.org/2009/09/imported'

Up to date example usage please!

Given that JAXB is not included in JDK 1.6 and higher, I was wondering if the usage examples could be updated.

It should no longer be necessary to include jaxb in the dependencies {} section; Ideally I would like to get as clean as possible demo/usage with JDK 1.6 and higher. Can the docs be updated?

Issues when project path contains spaces

We are using the plugin in Ehcache 3 but it is broken on the CI environment due to the presence of space (%20 in URL encoding) in the path. See this specific build

I have tracked down the cause to a missing quoting of the episodeFile property when passed to the xjc ant task in org.gradle.jacobo.plugins.ant.AntXjc - see here

I did not check if such quoting is required in other places as once this one if fixed, the build passes when the project path contains a space in it.

destinationDir default

Typically you wouldn't want to use the default destinationDir of "src/main/java" because it would mingle written code with generated code. It would be nice if the default was to put the generated source into the buildDir and then add that dir to the sourceSet.

java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener

what am I doing wrong? I'm getting java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener when running ./gradlew xjc. The following is my build file

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-release" }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2'
        classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4'
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'com.github.jacobono.jaxb'


jar {
    baseName = 'mef-service'
    version =  '0.1.0'
}

// This is to make Spring-Loaded pick up changes when compiling through Intellij
idea {
    module {
        inheritOutputDirs = false
        outputDir = file("$buildDir/classes/main/")
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "http://repo.spring.io/libs-release" }
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web",
            "org.springframework.boot:spring-boot-starter-jetty",
            "org.springframework.boot:spring-boot-starter-security",
            "org.springframework.boot:spring-boot-starter-actuator",
            "org.springframework.boot:spring-boot-starter-data-mongodb")

    compile fileTree("libs")

    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
    jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
    jaxb 'javax.xml.bind:jaxb-api:2.2.11'


    testCompile("org.springframework.boot:spring-boot-starter-test",
                "com.jayway.restassured:json-path:2.3.4",
                "com.jayway.restassured:rest-assured:2.3.4")
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.1'
}

jaxb {
    xsdDir = "src/main/resources/mef-schemas/2014v3.0"
    xjc {
        destinationDir     = "src/main/java/mef/generator/rushtax/generated"
        generatePackage    = "rushtax.mef.generator.generated"
        args               = ["-Xinheritance", "-Xannotate"]
    }
}

TreeNodeSpec unit test fails with verify error

I forked and cloned master, and when I finally built it, a unit test failed with the following:

java.lang.VerifyError: (class: org/gradle/jacobo/plugins/tree/TreeNode$1, method: super$1$sort signature: (Ljava/util/Comparator;)V) Illegal use of nonvirtual function call
at org.gradle.jacobo.plugins.tree.TreeNode.(TreeNode.groovy:65)
at org.gradle.jacobo.plugins.tree.TreeNodeSpec.Create node with data, and one parent(TreeNodeSpec.groovy:31)

Looking at TreeNode.groovy:

public TreeNode(T data, TreeNode parent) {
this.parents = new LinkedList<TreeNode>() {{ add(parent) }} // line 65
this.children = new LinkedList<TreeNode>()
this.data = data
parent.addChild(this, false)
}

I'm not yet a native Groovy speaker (compared to Java), so I'm not sure what's going on here. When I commented out the single "Create node with data, and one parent" test, the build succeeded.

I tried various hacks that were implied on the internet, like adding "-Xverify:none". I tried setting the JDK compile level to 1.6, 1.7, and 1.8. No change.

How to specify xjc extensions?

I see that you can set the "extension mode" flag, but how do you specify the extensions to use, and the arguments to those extensions? For instance, in the Maven "cxf-xjc-plugin" plugin, I can specify an "extensions" section in the configuration where specify the GAV tuples for my extensions, and then in the "xsdOptions" section, I can specify "extensionArgs" with the command line options for those extensions.

Property 'XXXX' is already defined. Use &lt;jaxb:property> to resolve this conflict.

I'm trying to generate the Java classes from a zip file with a bunch of schemas files plus some binding files.
My gradle build file is as follows:

dependencies {
    jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41' //jaxws 2.2.6 uses jaxb 2.2.5, but can't dL 2.2.5 from maven the pom is off TODO
    jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
    jaxb 'javax.xml.bind:jaxb-api:2.2.7'

    jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
    jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.5"
}

jaxb {
    xsdDir = "/src/main/resources/schema"
    bindings = ["bindings.xjc","bindings2.xjc"]
    xjc {
        taskClassname      = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
        generatePackage    = "com.soler.xsd"
        args               = ["-Xannotate"]
    }
}

When I execute gradle xjc, I'm getting the following error:

14:02:32.917 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] [ERROR] Property "Type" is already defined. Use &lt;jaxb:property> to resolve this conflict.
14:02:32.921 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]   line 494 of file:/C:/dev/XXX/src/main/resources/schema/external/YYY/ZZZ.xsd
14:02:32.922 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]
14:02:32.923 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] [ERROR] The following location is relevant to the above error
14:02:32.923 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]   line 540 of file:/C:/dev/XXX/src/main/resources/schema/external/YYY/ZZZ.xsd
14:02:32.924 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]
14:02:32.941 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.942 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:02:32.944 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.945 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:02:32.945 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':ext/stix:xjc'.
14:02:32.946 [ERROR] [org.gradle.BuildExceptionReporter] > unable to parse the schema. Error messages should have been provided
14:02:32.948 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.949 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
14:02:32.950 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.

Many places recommend the following link Dealing with errors but I'm not sure how that applies to this plugin.

Thanks

xjc to generate packages from the xsd file <jxb:package name="example.test"/>

It seems I cannot leave the generatePackage empty because my sources will land in the generated package.

According to the docs:
https://jaxb.java.net/2.2.4/docs/xjc.html

Here under Compiler restrictions they claim that if you won't set the -p attribute the next choice is to look the xsd file, but I guess it's not happening. Can you tell me how I can accomplish that task ?

Example file

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
           jxb:version="2.0"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           jxb:extensionBindingPrefixes="xjc">
  <xs:annotation>
    <xs:appinfo>
      <jxb:globalBindings>
        <xjc:simple />
      </jxb:globalBindings>
      <jxb:schemaBindings>
        <jxb:package name="com.custom.package"/>
      </jxb:schemaBindings>
    </xs:appinfo>
  </xs:annotation>
</xs:schema>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.