ciscoo / cxf-codegen-gradle

Gradle plugin to generate Java artifacts from WSDL
Apache License 2.0
26 stars 6 forks source link

plugin provider jaxb context init failed #78

Closed epozuelo closed 1 year ago

epozuelo commented 1 year ago

I'm running the 1.2.0 plugin version with gradle 7.6.1 and cxf 4.0.0, Java 11. My setup looks like this:

cxfCodegen {
    cxfVersion = "4.0.0"
}

dependencies {
    cxfCodegen "jakarta.xml.bind:jakarta.xml.bind-api:4.0.0"
}

import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java
tasks.register("wsdl", Wsdl2Java) {
    toolOptions {
        wsdl.set(file("src/main/resources/service.wsdl"))
        // see https://github.com/ciscoo/cxf-codegen-gradle/issues/73
        wsdlLocation.set("classpath:src/main/resources/service.wsdl")
        outputDir.set(file("$buildDir/generated-java"))
    }
}

Running gradle wsdl2java I get:

> Task :wsdl FAILED
Mar 08, 2023 4:52:35 PM org.apache.cxf.tools.wsdlto.core.PluginLoader init
SEVERE: Tools plugin provider jaxb context init failed
Exception in thread "main" org.apache.cxf.tools.common.ToolException: Tools plugin provider jaxb context init failed
        at org.apache.cxf.tools.wsdlto.core.PluginLoader.init(PluginLoader.java:83)
        at org.apache.cxf.tools.wsdlto.core.PluginLoader.<init>(PluginLoader.java:73)
        at org.apache.cxf.tools.wsdlto.core.PluginLoader.newInstance(PluginLoader.java:106)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.<init>(WSDLToJava.java:48)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:181)

FAILURE: Build failed with an exception.

The code generation works if I target cxfVersion 3.5.5. I have been unable to find what could be wrong. I'm thinking it may be a missing Jakarta/javax dependency in the plugin, with the PluginLoader hiding the real reason.

ciscoo commented 1 year ago

Are you able to provide a minimal, reproducible example? Without it, I will not be able to deduce if it is this plugins issue by not configuring the classpath correctly, or an issue on a project's end by not including required dependencies for code generation.

ciscoo commented 1 year ago

Closing due to inactivity.

If you feel that this is a genuine issue with this plugin, please spend some time creating minimum, reproducible example that reproduces the problem. The example can either be a zip archive attached to this issue or a separate Git repository. The example should be something that can built/run without any additional setup.