Marco Semiao created CXF-9288:
---------------------------------
Summary: Add automatic discovery of JAXB episode files from Maven
dependencies (useDependenciesAsEpisodes)
Key: CXF-9288
URL: https://issues.apache.org/jira/browse/CXF-9288
Project: CXF
Issue Type: Improvement
Reporter: Marco Semiao
h3. Context / Problem
In multi-module architectures where XSD schemas are shared across several
projects, common JAXB classes are typically generated once in a dedicated Maven
module (packaging a JAXB episode file) and imported as a dependency in
downstream modules.
Currently, when running {{wsdl2java}} via {{cxf-codegen-plugin}}, preventing
the regeneration of these already-compiled classes requires manually declaring
each episode file in the plugin configuration (via {{<bindingFiles>}} or
{{<extraargs>}}), which becomes verbose and error-prone as the number of shared
dependencies grows.
h3. Proposed Feature
Add an opt-in configuration parameter {{<useDependenciesAsEpisodes>}} (boolean,
{{false}} by default to preserve backward compatibility), inspired by
{{org.codehaus.mojo:jaxb2-maven-plugin}} (since version 4.1.1) and
{{jaxb-tools}}.
When {{<useDependenciesAsEpisodes>true</useDependenciesAsEpisodes>}} is enabled:
# The plugin scans direct Maven project dependencies in {{compile}} and
{{runtime}} scopes (optionally paired with
{{<includeTransitiveEpisodes>false</includeTransitiveEpisodes>}}).
# For each dependency JAR, it looks for a JAXB episode resource following
standard conventions:
#* {{META-INF/sun-jaxb.episode}}
#* {{META-INF/JAXB/*.xjb}}
# Discovered episode files are extracted (e.g., under
{{${project.build.directory}/cxf-episodes/}}) and automatically passed as
external binding files to XJC during {{wsdl2java}} execution.
h3. Example Configuration
{code:xml}
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<configuration>
<useDependenciesAsEpisodes>true</useDependenciesAsEpisodes>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
{code}
h3. Expected Benefits
* Greatly simplifies Maven configuration in projects sharing common XSD data
models.
* Avoids duplicate generated classes and classpath conflicts.
* Aligns {{cxf-codegen-plugin}} with standard episode handling in other Maven
JAXB plugins.
h3. Contribution Offer
Before starting implementation, I would like to check if the community and
maintainers are interested in adding this feature to {{cxf-codegen-plugin}}. If
there is interest and agreement on the approach, I would be happy to implement
it and submit a Pull Request.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)