rackerlabs / gradle-jaxb-plugin

Gradle plugin to ease projects that use xsds and the ant jaxb task
GNU General Public License v2.0
34 stars 21 forks source link

how can can I generate different package name for different xsd file? #40

Closed stanleyw2014 closed 6 years ago

stanleyw2014 commented 6 years ago

Hi, I want to generate different package name for different XSD file(a.xsd->package com.example.a, b.xsd->package com.example.b), I tried to use xsdIncludes, and defined two xjc tasks, but I didn't got what I wanted, below is my xjc tasks: jaxb { xsdDir = "${project.projectDir}/src/main/resources" xsdIncludes.add("a.xsd") xjc { destinationDir = "${project.projectDir}/src/main/java" generateEpisodeFiles = false taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task" generatePackage = "com.example.a"

}

}

jaxb { xsdDir = "${project.projectDir}/src/main/resources" xsdIncludes.add("b.xsd") xjc { destinationDir = "${project.projectDir}/src/main/java" generateEpisodeFiles = false taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task" generatePackage = "com.example.b"

}

}

wdschei commented 6 years ago

What you appear to be trying to do will require a bindings file. I created a Short, Self Contained, Correct (Compilable), Example or Minimal, Complete, and Verifiable example project for another issue that should give you a better understanding of how to use this feature.

The project can be found here.

stanleyw2014 commented 6 years ago

Thanks, William, it works!