无法执行目标org.jibx:maven-jibx-plugin:1.2.6:从Java 1.6升级到1.8时绑定

时间:2016-11-08 19:15:55

标签: java maven java-8 jibx

由于maven-jibx-plugin期间mvn install中的例外,无法构建项目。

环境信息:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: C:\Data\apps\apache-maven-3.3.9\bin\..
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_112\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"

ERROR:

无法执行目标org.jibx:maven-jibx-plugin:1.2.6:项目xxxx-core上的bind(默认):加载类java.lang.CharSequence时出错

的pom.xml:

  <plugin>
    <groupId>org.jibx</groupId>
    <artifactId>maven-jibx-plugin</artifactId>
    <version>1.2.6</version>
    <configuration>
      <includes>
        <includes>*-binding.xml</includes>
      </includes>
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>bind</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

堆栈跟踪:

[ERROR] Failed to execute goal org.jibx:maven-jibx-plugin:1.2.6:bind (default) on project xxxx-core: Error loading class java.lang.CharSequence: Error reading path java/lang/CharSequence.class for class java.lang.CharSequence -> [Help
1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jibx:maven-jibx-plugin:1.2.6:bind (default) on project xxxx-core: Error loading class java.lang.CharSequence: Error reading path java/lang/CharSequence.
class for class java.lang.CharSequence
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error loading class java.lang.CharSequence: Error reading path java/lang/CharSequence.class for class java.lang.CharSequence
        at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:166)
        at org.jibx.maven.AbstractBaseBindingMojo.execute(AbstractBaseBindingMojo.java:133)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.IllegalStateException: Error loading class java.lang.CharSequence: Error reading path java/lang/CharSequence.class for class java.lang.CharSequence
        at org.jibx.binding.classes.ClassCache$ClassCacheLocator.getClassInfo(ClassCache.java:291)
        at org.jibx.binding.model.ClassHierarchyContext.accumulateInterfaces(ClassHierarchyContext.java:95)
        at org.jibx.binding.model.ClassHierarchyContext.addTypedComponent(ClassHierarchyContext.java:121)
        at org.jibx.binding.model.DefinitionContext.addFormat(DefinitionContext.java:527)
        at org.jibx.binding.model.BindingElement.defineBaseFormat(BindingElement.java:843)
        at org.jibx.binding.model.BindingElement.runValidation(BindingElement.java:865)
        at org.jibx.binding.model.BindingElement.runValidation(BindingElement.java:899)
        at org.jibx.binding.model.BindingElement.validateBinding(BindingElement.java:969)
        at org.jibx.binding.Utility.validateBinding(Utility.java:226)
        at org.jibx.binding.Utility.loadBinding(Utility.java:269)
        at org.jibx.binding.Utility.loadFileBinding(Utility.java:420)
        at org.jibx.binding.Compile.compile(Compile.java:217)
        at org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:163)
        ... 23 more

2 个答案:

答案 0 :(得分:3)

找到修复程序。

用版本6.0覆盖BCEL依赖性:

<plugin>
    <groupId>org.jibx</groupId>
    <artifactId>maven-jibx-plugin</artifactId>
    <version>1.2.6</version>
    <configuration>
        <includes>
            <includes>*-binding.xml</includes>
        </includes>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>bind</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.apache.bcel</groupId>
            <artifactId>bcel</artifactId>
            <version>6.0</version>
        </dependency>
    </dependencies>
</plugin>

答案 1 :(得分:1)

实际上,新版本的JiBX 1.3.0与jdk 1.8兼容。 此版本的JiBX将于2016年11月30日发布。 您可以在此处下载预发布版本: JiBX 1.3.0-SNAPSHOT

maven工件已上传到maven中央快照仓库。 JIBX版本是1.3.0-SNAPSHOT。