JAXB2 maven plugin in eclipse shows error

2019-09-13 20:17发布

问题:

I'm using JDK 1.6 (due to dependencies) and to generate classes from xsd, I have added maven-jaxb2 plugin as shown below in pom.xml.

But the eclipse (Kepler) complains as below.

Error parsing the command line [[-Xsimplify, -episode, D:\test\workspace\sample\target\generated-sources\xjc\META-INF\sun-jaxb.episode]] (org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.8.1:generate:jaxb-test:generate-sources)

pom.xml

<plugins>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.9.0</version>
        <executions>
            <execution>
                <id>jaxb-test</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <forceRegenerate>true</forceRegenerate>
                    <schemaDirectory>src/main/resources</schemaDirectory>
                    <schemaIncludes>
                        <include>sample.xsd</include>
                    </schemaIncludes>
                    <xjbSources>
                        <xjbSource>bindings.xjb</xjbSource>
                    </xjbSources>
                </configuration>
            </execution>
        </executions>
        <configuration>
            <extension>true</extension>
            <args>
                <arg>-Xsimplify</arg>
            </args>
            <plugins>
                <plugin>
                    <groupId>org.jvnet.jaxb2_commons</groupId>
                    <artifactId>jaxb2-basics</artifactId>
                    <version>0.6.0</version>
                </plugin>
            </plugins>
        </configuration>
    </plugin>
</plugins>

回答1:

Try to upgrade to maven-jaxb2-plugin 0.13.1, and jaxb2-basics 0.11.0.

The versions you have now are very old already.