Eclipse error message for jvnet maven-jaxb2-plugin version 0.13.0

杀马特。学长 韩版系。学妹 提交于 2019-12-12 15:31:37

问题


I am trying the sample JAXB Maven project with jvnet maven-jaxb2-plugin from GitHub https://github.com/highsource/maven-jaxb2-plugin/releases. I am using the latest version 0.13.0 and downloaded maven-jaxb2-plugin-sample-jaxbplugins-0.13.0-maven-src.zip

I am successful in running the mvn clean install via command line. But when I import it into Eclipse Luna, I got an error message like this:

Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.0:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.0:generate: com/sun/xml/bind/api/ErrorListener

It is interesting that I can still use the Maven tool to run as Maven install and get the generated classes. But the error message is there annoying me. Is that some Eclipse bug or what? Please help.

This is the core part of the pom.xml

<dependencies>
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>2.2.11</version>
    </dependency>
    <dependency>
        <groupId>org.jvnet.jaxb2_commons</groupId>
        <artifactId>jaxb2-basics-runtime</artifactId>
        <version>0.9.0</version>
    </dependency>
</dependencies>
<build>
    <defaultGoal>install</defaultGoal>
    <plugins>
    <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.13.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <args>
                    <arg>-XtoString</arg>
                    <arg>-Xequals</arg>
                    <arg>-XhashCode</arg>
                    <arg>-Xcopyable</arg>
                    </args>
                    <plugins>
                    <plugin>
                    <groupId>org.jvnet.jaxb2_commons</groupId>
                    <artifactId>jaxb2-basics</artifactId>
                    <version>0.9.0</version>
                    </plugin>
                    </plugins>
                </configuration>
            </execution>
        </executions>
    </plugin>
    </plugins>
</build>

回答1:


I was able to get rid of those "Problems" by adding the following line into my eclipse ini like described in:

http://diggingthroughcode.blogspot.de/2016/05/trouble-with-maven-jaxb2-plugin-and.html

-vm
C:\Program Files\Java\jdk1.8.0_92\bin\javaw.exe

after pressing Alt+F5 (Update Project) everything was ok.

my setup java: 1.8.0_92 / eclipse: Luna SR2 (4.4.2) = STS 3.7.0




回答2:


Please do a Run as > Maven build... > Goals: clean generate-resources > Debug Output > Run and post the full log (pastebin or whatever).

I suspect you have some outdated JDK but it's hard to tell. I can't reproduce this with Ecliplse Luna 4.4.0 and Java 1.7.0_51.

Disclaimer: I'm the author of the maven-jaxb2-plugin.




回答3:


I had this issue on the CLI after installing JDK 9; setting JAVA_HOME to JDK 8 before running mvn clean jaxb2:generate worked in that case:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/


来源:https://stackoverflow.com/questions/34095110/eclipse-error-message-for-jvnet-maven-jaxb2-plugin-version-0-13-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!