mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
106 stars 77 forks source link

org.xml.sax.SAXParseException: generating code #121

Open zosrothko opened 5 years ago

zosrothko commented 5 years ago

Hi I am running this configuration

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <goals>
                <goal>xjc</goal>
            </goals>
            <configuration>
                <outputDirectory>src-generated</outputDirectory>
                <packageName>com.scort.logconfigurator.jaxb</packageName>
                <schemaDirectory>src/main/xsd</schemaDirectory>
                <schemaFiles>logmetadata.xsd</schemaFiles>
                <clearOutputDir>true</clearOutputDir>
                <extension>true</extension>
                <verbose>true</verbose>
            </configuration>
        </execution>
    </executions>
</plugin>

with those src/main/xsd files log4j.xsd.txt log4j1.xsd.txt logmetadata.xsd.txt

and got this exception

Z:\MXW\MI\MI-4.3\LogConfigurator>C:\ASF\apache-maven-3.5.4\bin\mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< com.scort.mi.logconfigurator:scortlogconfigcore >-----------
[INFO] Building Scort LogConfigurator Core Library 1.3.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ scortlogconfigcore ---
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\target
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated (includes = [*], excludes = [])
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\xmlbeans (includes = [*], excludes = [])
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ scortlogconfigcore ---
[INFO]
[INFO] --- xmlbeans-maven-plugin:2.3.3:xmlbeans (default) @ scortlogconfigcore ---
[INFO]
[INFO] --- jaxb2-maven-plugin:2.4:xjc (default) @ scortlogconfigcore ---
[INFO] Created EpisodePath [Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated\META-INF\JAXB]: true
[INFO] Created EpisodePath [Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated\META-INF\JAXB]: true
[INFO] null [-1,-1]
org.xml.sax.SAXParseException: generating code
    at com.sun.tools.xjc.ErrorReceiver.debug (ErrorReceiver.java:140)
    at com.sun.tools.xjc.Driver.run (Driver.java:382)
    at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution (AbstractJavaGeneratorMojo.java:468)
    at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute (AbstractJaxbMojo.java:315)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO]

The log of this command: C:\ASF\apache-maven-3.5.4\bin\mvn clean install -X -l mvn.log mvn.log

stefanwendelmann commented 4 years ago

Same problem here, when i use the default at src/main/xjb/ all Adapters are created, when i use custom xjbSources i get the silence error shown with verbose as above

knuspertante commented 4 years ago

Is it possible that verbose are the culprit

see #159

stefanwendelmann commented 3 years ago

@knuspertante commenting out the <verbose>true</verbose> is hiding the error, but the pojos are still not generated.

JSamir commented 3 years ago

Also having this issue.

In my case the classes do get generated, but they are not added to classpath in vscode, although they should. While investigating this I came across this error.