Converting XJC from Maven to Gradle (using Ant task), having trouble with extensions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Converting XJC from Maven to Gradle (using Ant task), having trouble with extensions

KARR, DAVID (ATTSI)
I have a CXF JAX-RS app being built with Maven.  I'm working on converting it to Gradle, but using the Ant XJC task.

The current build uses a couple of extensions, one of which is a copy of the "element wrapper" plugin, and the other is the "jaxb-fluent-api".

I tried putting the jars for those two plugins into the xjc classpath, but when I run the XJC task, I get the following:

java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider dk.conspicio.jaxb.plugins.XmlElementWrapperPlugin not a subtype

Any idea how I have to do this differently?

If it matters, my Maven configuration for the xjc plugin looks something like this:
----------------
<plugin>
     <groupId>org.apache.cxf</groupId>
     <artifactId>cxf-xjc-plugin</artifactId>
     <executions>
         <execution>
             <id>generate-sources</id>
             <phase>generate-sources</phase>
             <goals>
                                <goal>xsdtojava</goal>
             </goals>
             <configuration>
                                <extensions>
                    <extension>JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0</extension>
                    <extension>net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8</extension>
                </extensions>
                <xsdOptions>
                                        <xsdOption>
                                                <xsd>${basedir}/src/main/resources/schema/serviceCallResults.xsd</xsd>
                                                <packagename>com.att.sunlight.service.domain.serviceCallResults</packagename>
                                                <extension>true</extension>
                                                <extensionArgs>
                                                        <extensionArg>-Xxew</extensionArg>
                                                        <extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
                                                        <extensionArg>-instantiate lazy</extensionArg>
                                                        <extensionArg>-Xfluent-api</extensionArg>
                                                </extensionArgs>
                                        </xsdOption>
                </xsdOptions>
            </configuration>
        </execution>
     </executions>
</plugin>
------------------

My attempt at the Gradle task is 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) {
                schema(dir: "src/main/resources/schema", includes: "serviceCallResults.xsd")
        }

}
-------------------

winmail.dat (5K) Download Attachment
Loading...