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

Migrate to 2.0.0 #29

Open
raoulduke98 opened this issue Feb 19, 2021 · 2 comments
Open

Migrate to 2.0.0 #29

raoulduke98 opened this issue Feb 19, 2021 · 2 comments

Comments

@raoulduke98
Copy link

raoulduke98 commented Feb 19, 2021

Hi,
I'm using an old version of an gradle xjc plugin and had two tasks there in my build.gradle:

task xjcGenerateObjects1(type: XjcGenerateTask) {
  source = fileTree('src/main/resources/proj1') { include  '**/objects1.xsd' }
  bindingFiles = fileTree('src/main/resources/proj1') { include '**/objects1.xjb' }
}

task xjcGenerateObjects2(type: XjcGenerateTask) {
  source = fileTree('src/main/resources/proj2') { include  '**/objects2.xsd' }
  bindingFiles = fileTree('src/main/resources/proj2') {include '**/objects2.xjb' }
}

Now I migrated to Java 11 and gradle-xjc-plugin 2.0. How can I migrate above code? I tried following, but was not successful:

sourceSets {
  main {
    xjcSchema {
      srcDir 'src/main/resources/proj1'
      includes = ['objects1.xsd']
    }
    xjcBinding {
      srcDir 'src/main/resources/proj1'
      includes = ['objects1.xjb']
    }
  }
  main2 {
    xjcSchema {
      srcDir 'src/main/resources/proj2'
      includes = ['objects2.xsd']
    }
    xjcBinding {
      srcDir 'src/main/resources/proj2'
      includes = ['objects2.xjb']
    }
  }
}
@mjparme
Copy link

mjparme commented Aug 27, 2021

@Carlfriedman did you ever figure this out? I had some code that looked very similar to yours to include wsdl files for the -wsdl parameter but can't seem to get verison 2 of the plugin to generate code from a wsdl.

@mjparme
Copy link

mjparme commented Aug 27, 2021

FWIW, I got it to work just by setting srcDirName to "resources". You don't have to mess with the sourcesets since the plugin already includes all xjb and xsd files. The relationship between srcDir in the sourceset and the srcDirName in the xjc config block is unclear.

xjc {
    srcDirName = "resources"
}

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