Skip to content

Dependency Management

The plugin adds a single dependency configuration to the project named cxfCodegen.

The configuration is used to manage the dependencies required by Apache CXF for code generation.

Default Dependencies

The following dependencies are included by default in the cxfCodegen configuration:

DependencyVersonExclusions
org.apache.cxf:cxf-core4.2.2None
org.apache.cxf:cxf-tools-common4.2.2None
org.apache.cxf:cxf-tools-wsdlto-core4.2.2None
org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb4.2.2None
org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws4.2.2None
org.apache.cxf:cxf-tools-wsdlto-frontend-javascript4.2.2org.apache.cxf:cxf-rt-frontend-simple

These are the same dependencies defined in the Maven plugin's POM.

CXF Version

The version of CXF can be controlled by configuring the cxfVersion property on the extension. The convention of the version is 4.2.2.

If this convention does not work for your project, override the cxfVersion property on the extension to specify a different version.

The following example shows how to override the CXF version to 4.2.1.

kotlin
cxfCodegen {
    cxfVersion = "4.2.1"
}
groovy
cxfCodegen {
    cxfVersion = "4.2.1"
}

WARNING

You will need to ensure the version of CXF you specify is compatible with the tool options used and your application's version of Jakarta EE

Failure to do so can result in an error during code generation, compilation errors, runtime errors, or a combination of these.

The cxfVersion property is a Gradle type Property<String> which enables lazy configuration.

Refer to Gradle's Understanding Properties documentation to better understand this concept.

TIP

You can use any Gradle dependency management configuration to configure dependency versions. For example, a resolution rule can be configured to force a specific version of a dependency.

The property approach shown above is preferred for its simplicity.

Adding Dependencies

The cxfCodegen configuration can be used to add additional dependencies to the code generation classpath.

The following example shows adding the cxf-rt-databinding-jibx dependency to the cxfCodegen configuration. This dependency will be included in the code generation classpath.

kotlin
dependencies {
    cxfCodegen("org.apache.cxf:cxf-rt-databinding-jibx:3.1.18")
}
groovy
dependencies {
    cxfCodegen "org.apache.cxf:cxf-rt-databinding-jibx:3.1.18"
}

Released under Apache 2.0 license