Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsd2java option #27

Closed
rakesh76 opened this issue Sep 15, 2015 · 1 comment
Closed

xsd2java option #27

rakesh76 opened this issue Sep 15, 2015 · 1 comment

Comments

@rakesh76
Copy link

Hi,

It seems in my example , xsd2java is not taking option parameter value when it's generating code

here is my example

xsd2java {
def contractDir = "$buildDir/extractedContracts"
File perContract = new File("$contractDir/Enterprise.xsd")
File adContract = new File("$contractDir/AdFpc.xsd")
File adListContract = new File("$contractDir/AdListData.xsd")

xsdsToGenerate = [
[file("$perContract"), 'com.performance.contract',[value:"-Xtbs -XautoNameResolution"]],
[file("$adContract"), 'ad.contract',[value:"-Xtbs -XautoNameResolution"]],
[file("$adListContract"), 'ad.list.contract',[value:"-Xtbs -XautoNameResolution"]],
]
generatedXsdDir = file(project.ext.generatedSrcDir)
}

-Xtbs generate equals, hashcode and toString method.

while it's successfully generating using below code.

task generateSources << {
def genSrcDir = new File(project.ext.generatedSrcDir)
genSrcDir.mkdirs()
def perContractJar = configurations.generate.find { it.name.equals("per-contract-1.0.0-18.jar") }
def aeroContractJar = configurations.generate.find { it.name.equals("aero1.0.0-11.jar") }
ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJC2Task', classpath: configurations.generate.asPath)
ant.xjc(package: 'com.performance.contract', destdir: project.ext.generatedSrcDir, extension: 'true',
schema: "jar:file:///$perContractJar!/Enterprise.xsd" ) { arg(line:"-XautoNameResolution -Xtbs") }
ant.xjc(package: 'ad.dispatchper.contract', destdir: project.ext.generatedSrcDir, extension: 'true',
schema: "jar:file:///$aeroContractJar!/AdFpc.xsd" ) { arg(line:"-XautoNameResolution -Xtbs") }
sourceSets.main.java.srcDirs += project.ext.generatedSrcDir
}

Let me know your suggestion what needs to be change in my syntax to make it work.

@nilsmagnus
Copy link
Owner

xsd2java has been removed from this plugin to reduce the scope. Feel free to clone the old sources and publish a new plugin based on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants