ErrorListener is missing when using maven-jaxb-plugin with eclipse and m2e

I installed the project only for the plugin " org.jvnet.jaxb2.maven2:maven-jaxb2-plugin" . It works, but I do not like the error message displayed in the Eclipse editor for "pom.xml". The message says:

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

So far, this marked the entire project as erroneous.

Here is my pom.xml:

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.gombers.lernen.jaxb</groupId> <artifactId>PlayWithJAXB</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9.1</version> <configuration> <show>private</show> <nohelp>true</nohelp> </configuration> </plugin> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.13.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <extension>true</extension> <useDependenciesAsEpisodes>true</useDependenciesAsEpisodes> <outputDirectory>target/generated-sources/jaxb</outputDirectory> <packageName>de.gombers.lernen.jaxb.generated</packageName> <schemaDirectory>src/main/resources</schemaDirectory> <schemaFiles>Employee.xsd</schemaFiles> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <!-- JAXB --> <dependency> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin-core</artifactId> <version>0.13.1</version> </dependency> <dependency> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb22-plugin</artifactId> <version>0.13.1</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> <version>3.4</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-settings</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-container-default</artifactId> <version>1.0-alpha-9-stable-1</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.2.7</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.7</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.2.7</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-jxc</artifactId> <version>2.2.7</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-xjc</artifactId> <version>2.2.7</version> </dependency> <!-- HELPERS --> <dependency> <groupId>de.gombers</groupId> <artifactId>BasicTools</artifactId> <version>1.0.0</version> </dependency> <!-- LOGGING --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.13</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.2</version> </dependency> <!-- JUNIT --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.8.4</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <!-- JSON converter --> <dependency> <artifactId>jackson-core</artifactId> <groupId>com.fasterxml.jackson.core</groupId> <version>2.3.3</version> </dependency> <dependency> <artifactId>jackson-annotations</artifactId> <groupId>com.fasterxml.jackson.core</groupId> <version>2.3.3</version> </dependency> <dependency> <artifactId>jackson-databind</artifactId> <groupId>com.fasterxml.jackson.core</groupId> <version>2.3.3</version> </dependency> </dependencies> </project> 

In my command " mvn validate " no error is indicated, and the claimed ErrorListener is provided with the artifact " com.sun.xml.bind:jaxb-core ". And, as already mentioned, when you start a project to generate sources, it works great. Does anyone run this plugin and can share their pom.xml?

+8
java eclipse spring-boot maven jaxb
source share
5 answers

I solved this problem by removing any JREs from my Eclipse settings (Java> Installed JREs) and leaving only the highlighted JDK there. Although the JREs were not selected, they still cause the problem and should be removed. I was able to leave the JRE on my system. This post was helpful: http://diggingthroughcode.blogspot.ca/2016/05/trouble-with-maven-jaxb2-plugin-and.html

[Update] Another employee just ran into this, and it seemed to him that the decisive factor was that Java was used to run Eclipse. It will not use what is configured by JAVA_HOME, but the first Java runtime. He removed all jres from his system and left only jdk, and this solved the problem. I believe the deciding factor is whether eclipse works with jre or jdk. When I solved the problem, I removed one jre from my system, and this is most likely what used the eclipse. With this lack of jre, he switched to jdk, although I had other jres. If you do not want to remove jres from your system, you can specify which java application should use eclipse ( How to run eclipse with a different version of java? ). If nothing is specified, eclipse will determine the java runtime ( Find out what the Eclipse JVM works ).

+7
source share

This problem was caused by running eclipse on the JRE instead of the JDK.

Edit your eclipse.ini and specify the appropriate JDK - for example

 -vm C:/Program Files (x86)/Java/jdk1.7.0_55/bin/javaw.exe 
+3
source share

The same problem is solved here when I downgrade.

From:

  <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.13.1</version> 

To:

  <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.8.1</version> 

EDIT:

I tried the rest:

-Remove all JREs from Eclipse

- Starting Eclipse using the JDK

EDIT2:

Check the .m2 folder. Find the problem jar and check its size. In some situations, Maven might not load the dependency properly, and .jar may exist, but it is 0kb size. IF SO: Uninstall .jar and download Maven again.

+2
source share

You can try

 <build> <pluginManagement> <plugins> <plugin> ... </plugin> <plugin> ... </plugin> .... </plugins> </pluginManagement> </build> 
+1
source share

Updating the plugin to version 0.13.3 fixes this problem.

0
source share

All Articles