> -----Original Message-----
> From: Aaron Titus [mailto:[email protected]]
> Sent: Thursday, January 15, 2015 9:16 AM
> To: [email protected]
> Subject: Re: How to build a CXF JAX-RS app with Gradle?
>
> Yep, I have this working here. I just made a task that calls xjc or
> wsdl2java as needed. Here are some examples:
>
> 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')
>
> }
>
> }
My task looks like this:
-------------------------
task processXSDs() << {
ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask',
classpath: configurations.jaxb.asPath)
ant.xjc(destdir: 'tmp', package:
"com.att.sunlight.service.domain.serviceCallResults", extension: true) {
classpath(path: configurations.jaxb.asPath)
schema(dir: "src/main/resources/schema", includes:
"serviceCallResults.xsd")
arg(value: "-Xxew")
arg(value: "-summary target/xew-summary.txt")
arg(value: "-instantiate lazy")
arg(value: "-Xfluent-api")
}
}
-------------
Where I added the following to the jaxb configuration:
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.6'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.6'
jaxb 'javax.xml.bind:jaxb-api:2.2.6'
jaxb "JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0"
jaxb "net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8"
Unfortunately, I'm still having trouble with extensions. This is failing with
this:
--------------------
Caused by: java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin:
Provider dk.conspicio.jaxb.plugins.XmlElementWrapperPlugin not a subtype
at com.sun.tools.xjc.Options.findServices(Options.java:965)
at com.sun.tools.xjc.Options.getAllPlugins(Options.java:383)
--------------------
I can't even figure out what that error message means. I even decompiled the
"Options" class from the jar I assume this is coming from, and I can't find
that exception being thrown at that line.
> 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?
> >