Breaking Down Failed To Execute Goal
Discussion
The error "unrecognized parameter -episode" when using JAXB2 in Java 11+ is not about a missing episode, but a mismatch between plugin expectations and runtime environments. The jaxb2-maven-plugin version 3.2.0 targets Java 8 with legacy GlassFish bindings, yet your project runs on JDK 11 - where jaxb-jxc classes aren’t included in the plugin’s jar.
- The jaxb2-maven-plugin 3.2.0 relies on
com.sun.xml.bind:jaxb-jxc(available in Java 8 but excluded by default in newer Maven plugins). - Your project uses Java 11 with empty
jaxb2-maven-pluginconfigurations that omit proper source paths and source set integration. - The
xjcgoal expectsjaxb-jxcclasses at runtime, but your plugin’sdependenciessection only includesjaxb2-basics, skipping critical JAXB core bindings needed for Java 8 JAXB support. - The real culprit: The
sourcestag referencessrc/main/resources/xml/xsd, but Maven doesn’t process external XSDs unless explicitly included in source filtering. Withoutsourcesproperly linked to your XML definitions,xjcfails to locate bindings. - This isn’t a version mismatch of the plugin itself - rather, the plugin’s built-in JAXB classes don’t ship for Java 11, and your setup doesn’t trigger proper JAXB embedding.
Moving forward, avoid the 3.2.0 plugin in Java 11 environments. Instead, use the updated jaxb-tools workflow: import jaxb2-basics:2.0.15 with source inclusion and explicit JAXB bindings, ensuring Java 11 compatibility. The community’s recommended path avoids the legacy jaxb-jxc entirely, favoring built-in Jakarta XML Bind support.
The bottom line: The -episode parameter error hides a deeper misalignment - Java version, source setup, and dependency clarity matter more than version numbers. Are you truly using Java 11, or is your build environment emulating it? Double-check source directories and plugin dependencies to match both JDK and JAXB ecosystem.