title: How to compile multiple xsd files in Gradle JAXB/XJC?
body: <p>I'm fairly new to Gradle and I am facing some issues trying to compile multiple schema files using Gradle Ant XJC.</p>
  
  <p>Using the below code, I'm able to compile 1 schema successfully. However, I'm not sure how to do the same for multiple schema files. </p>
  
  <p>Any advice please?</p>
  
  <pre><code>//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task : XJC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  final def packageName = "org.test.webservice.domain"
  final def schemaFile = "misc/resources/schemas/employee-v3/wadl/employee.xsd"
  
  configurations { provided }
  project.ext.generatedSrcDir = file("$buildDir/generated-src")
  dependencies {
      provided 'com.sun.xml.bind:jaxb-impl:2.2.6'
      provided 'com.sun.xml.bind:jaxb-xjc:2.2.6'
  }
  task jaxb {
      println 'Starting JAXB XJC...'
      ext {
          packagePath = packageName.replaceAll("\\.", "/")
          srcFile = file(schemaFile)
          destDir = new File(project.ext.generatedSrcDir, packagePath)
      }
  
      inputs.file srcFile
      outputs.dir destDir
      project.ext.generatedSrcDir.mkdirs()
      ant.taskdef(name: 'xjc',
              classname: 'com.sun.tools.xjc.XJCTask',
              classpath: configurations.provided.asPath)
  
      doLast {
          project.ext.generatedSrcDir.mkdirs()
          ant.xjc(schema: srcFile, package: packageName,
                  destdir: project.ext.generatedSrcDir)
      }
  
      task generateSources() {}
      sourceSets.main.java.srcDirs += project.ext.generatedSrcDir
      generateSources.dependsOn jaxb
      compileJava.dependsOn generateSources
      eclipseClasspath.dependsOn generateSources
  //    ideaClasspath.dependsOn generateSources
  }
  </code></pre>