Yep, I have this working here.  I just made a task that calls xjc or
wsdl2java as needed. Here are some examples:



task linkWsdlToJavaClient(type:JavaExec) {

     main = "org.apache.cxf.tools.wsdlto.WSDLToJava"
     classpath = sourceSets.main.runtimeClasspath

     args "-d", "src3/main/java"
     args "-p", "com.example"
     args "-client", "src/samples/example1.wsdl"
}


task jaxbLinkRequest() << {

    ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask',
                classpath: configurations.jaxb.asPath)

        ant.xjc(destdir: 'src4',
                package: 'com.example',
                extension: 'true') {

            schema(dir: 'src/samples',
                   includes: 'example1.xsd,example2.wsdl')

        }

}


Personally,  I don't run these every build, and I check in the generated
code. This allows me to be able to build an older release exactly as it
was.  If you would rather have it generate every time, you can setup
dependencies so that this task will get run as part of the build.







On Thu, Jan 15, 2015 at 10:04 AM, KARR, DAVID <[email protected]> wrote:

> I have a CXF JAX-RS app that is being built with Maven.  I'm looking at
> converting the build to Gradle.
>
> I noticed the "gradle-jaxb-plugin" on github, which lets me run "xjc".
> However, I need one jaxb extension, and that doesn't provide access to
> extensions yet.
>
> My Maven build currently uses "cxf-xjc-plugin" to run xjc.  What does this
> do that is specific to CXF that "vanilla" xjc wouldn't do?
>
> Overall, I guess examples like this come close to "manually" calling xjc
> in Gradle:
> http://stackoverflow.com/questions/8158453/howto-generate-classes-from-wsdl-and-xsd-with-gradle-equivalent-to-maven-jaxb2
> .  It doesn't cover adding extensions, which I guess is just adding to the
> classpath and command-line arguments.
>
> Has anyone gone down this path who can provide examples?
>

Reply via email to