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:
| Dependency | Verson | Exclusions |
|---|---|---|
org.apache.cxf:cxf-core | 4.2.2 | None |
org.apache.cxf:cxf-tools-common | 4.2.2 | None |
org.apache.cxf:cxf-tools-wsdlto-core | 4.2.2 | None |
org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb | 4.2.2 | None |
org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws | 4.2.2 | None |
org.apache.cxf:cxf-tools-wsdlto-frontend-javascript | 4.2.2 | org.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.
cxfCodegen {
cxfVersion = "4.2.1"
}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.
dependencies {
cxfCodegen("org.apache.cxf:cxf-rt-databinding-jibx:3.1.18")
}dependencies {
cxfCodegen "org.apache.cxf:cxf-rt-databinding-jibx:3.1.18"
}