You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.restnext.org/routes"xmlns="http://www.restnext.org/routes"elementFormDefault="qualified">
<xs:elementname="routes">
<xs:annotation>
<xs:appinfo>This schema defines a RestNEXT Route Metadata.</xs:appinfo>
<xs:documentationsource="description">
This is the root element of the descriptor.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:elementname="route"maxOccurs="unbounded">
<xs:annotation>
<xs:documentationsource="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:elementname="path"type="xs:string">
<xs:annotation>
<xs:documentationsource="description">
This element defines the route path.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:elementname="provider">
<xs:annotation>
<xs:documentationsource="description">
This element defines the lambda string method reference route provider.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:patternvalue="([\w.])*([:]{2})(\w)+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:elementname="enable"type="xs:boolean"minOccurs="0"default="true">
<xs:annotation>
<xs:documentationsource="description">
This element defines if this route path is enable or not.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:elementname="methods"minOccurs="0">
<xs:annotation>
<xs:documentationsource="description">
This element defines the route allowed http methods.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:elementname="method"maxOccurs="unbounded">
<xs:annotation>
<xs:documentationsource="description">
This element defines a http method.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:enumerationvalue="GET"/>
<xs:enumerationvalue="POST"/>
<xs:enumerationvalue="PUT"/>
<xs:enumerationvalue="PATCH"/>
<xs:enumerationvalue="DELETE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:elementname="medias"minOccurs="0">
<xs:annotation>
<xs:documentationsource="description">
This element defines the route allowed media types.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:elementname="media"type="xs:string"maxOccurs="unbounded">
<xs:annotation>
<xs:documentationsource="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:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.restnext.org/securities"xmlns="http://www.restnext.org/securities"elementFormDefault="qualified">
<xs:elementname="securities">
<xs:annotation>
<xs:appinfo>This schema defines a RestNEXT Security Metadata.</xs:appinfo>
<xs:documentationsource="description">
This is the root element of the descriptor.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:elementname="security"maxOccurs="unbounded">
<xs:annotation>
<xs:documentationsource="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:elementname="path"type="xs:string">
<xs:annotation>
<xs:documentationsource="description">
This element defines the security path.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:elementname="provider">
<xs:annotation>
<xs:documentationsource="description">
This element defines the lambda string method reference security provider.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:patternvalue="([\w.])*([:]{2})(\w)+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:elementname="enable"type="xs:boolean"minOccurs="0"default="true">
<xs:annotation>
<xs:documentationsource="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>
ObjectFactory class generated by (jacobono/gradle-jaxb-plugin):
packageorg.restnext.core.jaxb.internal;
importjavax.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. * */@XmlRegistrypublicclassObjectFactory {
/** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal * */publicObjectFactory() {
}
/** * Create an instance of {@link Securities } * */publicSecuritiescreateSecurities() {
returnnewSecurities();
}
/** * Create an instance of {@link Securities.Security } * */publicSecurities.SecuritycreateSecuritiesSecurity() {
returnnewSecurities.Security();
}
}
ObjectFactory class generated by (highsource/maven-jaxb2-plugin):
packageorg.restnext.core.jaxb.internal;
importjavax.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. * */@XmlRegistrypublicclassObjectFactory {
/** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal * */publicObjectFactory() {
}
/** * Create an instance of {@link Routes } * */publicRoutescreateRoutes() {
returnnewRoutes();
}
/** * Create an instance of {@link Securities } * */publicSecuritiescreateSecurities() {
returnnewSecurities();
}
/** * Create an instance of {@link Routes.Route } * */publicRoutes.RoutecreateRoutesRoute() {
returnnewRoutes.Route();
}
/** * Create an instance of {@link Securities.Security } * */publicSecurities.SecuritycreateSecuritiesSecurity() {
returnnewSecurities.Security();
}
/** * Create an instance of {@link Routes.Route.Methods } * */publicRoutes.Route.MethodscreateRoutesRouteMethods() {
returnnewRoutes.Route.Methods();
}
/** * Create an instance of {@link Routes.Route.Medias } * */publicRoutes.Route.MediascreateRoutesRouteMedias() {
returnnewRoutes.Route.Medias();
}
}
The text was updated successfully, but these errors were encountered:
I had a similar issue and as far as I understand it, this behaviour is to be expected. You provide a package to the plugin, and it will put all generated classes in that package. Since your XSD's have elements with the same name, the existing class for routes.xsd will be overridden by those present in securities.xsd.
I was able to solve this issue by using jaxb bindings (see examples dir)
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:
build.gradle:
ObjectFactory class generated by (jacobono/gradle-jaxb-plugin):
ObjectFactory class generated by (highsource/maven-jaxb2-plugin):
The text was updated successfully, but these errors were encountered: