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
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 <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
The text was updated successfully, but these errors were encountered:
@martosoler you may have already realized this, given the age of this post, but the cause of your issue isn't this plugin. It's a legit problem that is causing xjc to be unable to create a class for an element.
The most likely culprit, in my experience, is that a child element and attribute have the same name (if a case-insensitive match is done). These happen often and are short work to square up using and xjb file to ensure distinct names. For example
...
<jaxb:bindings schemaLocation="file:/C:/dev/XXX/src/main/resources/schema/external/YYY/ZZZ.xsd">
<jaxb:schemaBindings>
<jaxb:package name="com.soler.xsd"/>
</jaxb:schemaBindings>
<!-- Used to avoid the duplicate element/attribute name conflict -->
<jaxb:bindings node="//xsd:attribute[@name='dataSource']">
<jaxb:property name="typeAttr"/>
</jaxb:bindings>
</jaxb:bindings>
...
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:
When I execute
gradle xjc
, I'm getting the following error:Many places recommend the following link Dealing with errors but I'm not sure how that applies to this plugin.
Thanks
The text was updated successfully, but these errors were encountered: