Skip to content

Generation fails with "compiler was unable to honor this enum customization" #629

Open
@rguillens

Description

@rguillens

I have a project with a module containing common schemas and other independent modules that use that common dependency.

The plugin is unable to generate the classes correctly using the common dependency as an episode correctly included in a catalog.

If the common dependency content is included as part of one of the independent module, discarding the usage of episode and catalog features, the generation works correctly; however I need the modular approach because I have more than one independent module.

Plugin usage:

<plugin>
    <groupId>org.jvnet.jaxb</groupId>
    <artifactId>jaxb-maven-plugin</artifactId>
    <version>4.0.8</version>
    <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <extension>true</extension>
                    <strict>false</strict>
                    <episodes>
                        <episode>
                            <groupId>my.project</groupId>
                            <artifactId>common-schemas</artifactId>
                        </episode>
                    </episodes>
                    <catalog>src/main/resources/catalog.cat</catalog>
                    <verbose>true</verbose>
                </configuration>
</plugin>

The dependency my.project:common-schemas contains an schema that uses jaxb:typesafeEnumClass declarations.

The plugin throws the folloging exception:

com.sun.istack.SAXParseException2: compiler was unable to honor this enum customization. It is attached to a wrong place, or its inconsistent with other bindings.
    at com.sun.tools.xjc.ErrorReceiver.error (ErrorReceiver.java:60)
    at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error (ErrorReporter.java:58)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check (UnusedCustomizationChecker.java:120)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check (UnusedCustomizationChecker.java:98)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.simpleType (UnusedCustomizationChecker.java:224)
    at com.sun.xml.xsom.impl.SimpleTypeImpl.visit (SimpleTypeImpl.java:134)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.elementDecl (UnusedCustomizationChecker.java:216)
    at com.sun.xml.xsom.impl.ElementDecl.visit (ElementDecl.java:223)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run (UnusedCustomizationChecker.java:84)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run (UnusedCustomizationChecker.java:75)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build (BGMBuilder.java:152)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build (BGMBuilder.java:90)
    at com.sun.tools.xjc.ModelLoader.annotateXMLSchema (ModelLoader.java:398)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:142)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:88)
    at org.jvnet.jaxb.maven.XJCMojo.loadModel (XJCMojo.java:59)
    at org.jvnet.jaxb.maven.XJCMojo.doExecute (XJCMojo.java:49)
    at org.jvnet.jaxb.maven.XJCMojo.doExecute (XJCMojo.java:29)
    at org.jvnet.jaxb.maven.RawXJCMojo.doExecute (RawXJCMojo.java:491)
    at org.jvnet.jaxb.maven.RawXJCMojo.execute (RawXJCMojo.java:330)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:41)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions