Skip to content

Using XJC Extensions

Workers

kotlin
import io.mateo.cxf.codegen.workers.Wsdl2JavaOption

// ...

dependencies {
    implementation("org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0") // <1>
    cxfCodegen("org.apache.cxf.xjcplugins:cxf-xjc-ts:4.0.0") // <2>
}

cxfCodegen {
    options {
        register<Wsdl2JavaOption>("calculator") { // <5>
            wsdl = layout.projectDirectory.file("calculator.wsdl").asFile.toPath().toAbsolutePath().toString()
            xjcArgs.add("-Xts") // <3>
        }
    }
}
groovy
import io.mateo.cxf.codegen.workers.Wsdl2JavaOption

// ...

dependencies {
    implementation "org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0" // <1>
    cxfCodegen "org.apache.cxf.xjcplugins:cxf-xjc-ts:4.0.0" // <2>
}

cxfCodegen {
    options {
        register("calculator", Wsdl2JavaOption) {
            wsdl = layout.projectDirectory.file("calculator.wsdl").asFile.toPath().toAbsolutePath().toString()
            xjcArgs.add("-Xts") // <3>
        }
    }
}
  1. Add the required CXF JXC dependency to your application dependencies.
  2. Add the extension dependency to the tool classpath.
  3. Specify extension ID that corresponds to the added dependency from (2); the -xjc prefix is not required when using the xjcArgs property.

Task

kotlin
import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java

// ...

dependencies {
    implementation("org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0") // <1>
    cxfCodegen("org.apache.cxf.xjcplugins:cxf-xjc-ts:4.0.0") // <2>
}

tasks.register("calculator", Wsdl2Java::class) {
    toolOptions {
        wsdl = layout.projectDirectory.file("calculator.wsdl").asFile.toPath().toAbsolutePath().toString()
        xjcArgs.add("-Xts") // <3>
    }
}
groovy
import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java

// ...

dependencies {
    implementation "org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0" // <1>
    cxfCodegen "org.apache.cxf.xjcplugins:cxf-xjc-ts:4.0.0" // <2>
}

tasks.register("calculator", Wsdl2Java) {
    toolOptions {
        wsdl = layout.projectDirectory.file("calculator.wsdl").asFile.toPath().toAbsolutePath().toString()
        xjcArgs.add("-Xts") // <3>
    }
}
  1. Add the required CXF JXC dependency to your application dependencies.
  2. Add the extension dependency to the tool classpath.
  3. Specify extension ID that corresponds to the added dependency from (2); the -xjc prefix is not required when using the xjcArgs property.

Released under Apache 2.0 license