org.codehaus.mojo:jaxb2maven插件:1.6-->;遇到API不兼容问题

org.codehaus.mojo:jaxb2maven插件:1.6-->;遇到API不兼容问题,maven,jaxb,xsd,xjc,jaxb2-maven-plugin,Maven,Jaxb,Xsd,Xjc,Jaxb2 Maven Plugin,使用时 来自codehaus的jaxb2 maven插件我在eclipse中得到了以下问题标记 此标记的内容包含以下内容: Description Resource Path Location Type Execution configuration of goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc failed: An API incompatibility was encountered while executing

使用时
来自codehaus的jaxb2 maven插件我在eclipse中得到了以下问题标记 此标记的内容包含以下内容:

Description Resource    Path    Location    Type
Execution configuration of goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc failed: An API incompatibility was encountered while executing org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc: java.lang.NoSuchMethodError: org.codehaus.plexus.util.DirectoryScanner.setupMatchPatterns()V
-----------------------------------------------------
realm =    plugin>org.codehaus.mojo:jaxb2-maven-plugin:1.6
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/develop/maven/repository/org/codehaus/mojo/jaxb2-maven-plugin/1.6/jaxb2-maven-plugin-1.6.jar
urls[1] = file:/C:/develop/maven/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
urls[2] = file:/C:/develop/maven/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar
urls[3] = file:/C:/develop/maven/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
urls[4] = file:/C:/develop/maven/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
urls[5] = file:/C:/develop/maven/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
urls[6] = file:/C:/develop/maven/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
urls[7] = file:/C:/develop/maven/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
urls[8] = file:/C:/develop/maven/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
urls[9] = file:/C:/develop/maven/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
urls[10] = file:/C:/develop/maven/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[11] = file:/C:/develop/maven/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[12] = file:/C:/develop/maven/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
urls[13] = file:/C:/develop/maven/repository/com/sun/xml/bind/jaxb-xjc/2.2.7/jaxb-xjc-2.2.7.jar
urls[14] = file:/C:/develop/maven/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar
urls[15] = file:/C:/develop/maven/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar
urls[16] = file:/C:/develop/maven/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar
urls[17] = file:/C:/develop/maven/repository/com/sun/xml/bind/jaxb-jxc/2.2.7/jaxb-jxc-2.2.7.jar
urls[18] = file:/C:/develop/maven/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar
urls[19] = file:/C:/develop/maven/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar
urls[20] = file:/C:/develop/maven/repository/org/codehaus/plexus/plexus-compiler-api/1.9.1/plexus-compiler-api-1.9.1.jar
urls[21] = file:/C:/develop/maven/repository/org/codehaus/plexus/plexus-utils/3.0.16/plexus-utils-3.0.16.jar
Number of foreign imports: 4
import: Entry[import org.sonatype.plexus.build.incremental from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.Scanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.AbstractScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------
 (org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc:configuration:generate-sources)  pom.xml 
插件的配置如下所示:

  <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jaxb2-maven-plugin</artifactId>
                    <version>1.6</version>
                    <executions>
                        <execution>
                            <id>data</id>
                            <goals>
                                <goal>xjc</goal>
                            </goals>
                            <configuration>
                                <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                                <schemaFiles>WebServiceDataSchema.xsd</schemaFiles>
                                <packageName>my.cool.package.jaxb.data</packageName> <!-- The name of your generated source package -->
                                <outputDirectory>${project.basedir}/src/gen/java</outputDirectory>
                                <target>2.1</target>
                            </configuration>
                        </execution>

                        <execution>
                            <id>configuration</id>
                            <goals>
                                <goal>xjc</goal>
                            </goals>
                            <configuration>
                                <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                                <schemaFiles>WebServiceConfigurationSchema.xsd</schemaFiles>
                                <packageName>my.cool.package.jaxb.config</packageName> <!-- The name of your generated source package -->
                                <outputDirectory>${project.basedir}/src/gen/java</outputDirectory>
                                <target>2.1</target>
                                <clearOutputDir>false</clearOutputDir>
                            </configuration>
                        </execution>

                    </executions>

                </plugin>

org.codehaus.mojo
jaxb2 maven插件
1.6
数据
xjc
${project.basedir}/src/main/resources
WebServiceDataSchema.xsd
my.cool.package.jaxb.data
${project.basedir}/src/gen/java
2.1
配置
xjc
${project.basedir}/src/main/resources
WebServiceConfiguration架构.xsd
my.cool.package.jaxb.config
${project.basedir}/src/gen/java
2.1
假的

有人有类似的问题吗?

我也有类似的错误。我使用jaxb2 maven插件的1.5版(而不是1.6版)解决了这个问题。

m2e似乎无法使用1.6插件处理多个执行块。不过,命令行maven可以正确运行这些表单。如果您支持1.5JAXB插件,m2e会很高兴,但该插件只运行第一个执行块,这会给您留下一个不同的中断构建


我的解决方案(到目前为止)是不使用m2e,尽管这显然不是最优的。

我也有同样的问题。我通过更新到最新的EclipseLuna4.4(Java开发人员版本,包括m2e wtp,而不是JavaEE版本)解决了这个问题。我猜它包含了一个更新版本的m2e wtp,它修复了这个问题(?!

经过几个小时的尝试,切换您对版本1.5的建议可以获得构建成功的输出。