IntershopCommunicationsAG / jaxb-gradle-plugin

Gradle JAXB code generation plugin
Apache License 2.0
33 stars 15 forks source link

xjc fails when two xsd files share a type #58

Open axlsml opened 1 year ago

axlsml commented 1 year ago

I am unable to generate java classes for the ITxPT spec. But the files can be generated individually. It seems to be a problem with the type IPv4Type that is used in both SubscribeRequestMessage.xsd and UnsubscribeRequestMessage.xsd

The failure message I am getting is:

2023-06-29T12:18:53.343+0200 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:jaxb] failure in the XJC task. Use the Ant -verbose switch for more details

To reproduce the issue:

plugins {
    id 'com.intershop.gradle.jaxb' version '6.0.0'
}

jaxb {
     javaGen {
        itxpt {
            schemas = fileTree("xsd/")
            packageName = "itxpt"
        }
    }
}
meshpaul commented 10 months ago

I think the work-around could be adding config element to resolve these and package name need to be set to empty so XJC will genereate using default package settings see

jaxb {
     javaGen {
        itxpt {
            schemas = fileTree("xsd/")
            packageName = ""
            arg("-XautoNameResolution")
        }
    }
}