我在尝试构建应用程序时遇到以下错误。这在运行测试时失败,否则它很好:
WARNING: Error injecting: org.jibx.maven.SchemaCodeGenMojo
java.lang.NoClassDefFoundError: org/jibx/runtime/JiBXException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getDeclaredConstructors(Class.java:1891)
[ERROR] Failed to execute goal org.jibx:maven-jibx-plugin:1.2.2:schema-codegen (generate-java-code-from-xml-schema) on project b2bservices-xml-api:
Execution generate-java-code-from-xml-schema of goal org.jibx:maven-jibx-plugin:1.2.2:schema-codegen failed: A required class was missing while executing org.jibx:maven-jibx-plugin:1.2.2:schema-codegen: org/jibx/runtime/JiBXException
我的pom看起来像:
<dependencies>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-bind</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<id>generate-java-code-from-xml-schema</id>
<phase>generate-sources</phase>
<goals>
<goal>schema-codegen</goal>
</goals>
<configuration>
<targetDirectory>${basedir}/src/main/java</targetDirectory>
<directory>${basedir}/src/main/resources/schemas</directory>
<includes>
<includes>xml_services.xsd</includes>
</includes>
<options>
<package>com.company.b2c.product.xml</package>
<prefer-inline>true</prefer-inline>
<show-schema>true</show-schema>
<binding-file-name>binding.xml</binding-file-name>
</options>
<verbose>true</verbose>
</configuration>
</execution>
</plugin>
</plugins>
</build>
现在这在构建过程中失败了。任何帮助将不胜感激。
答案 0 :(得分:0)
您需要在您的pom文件中包含JiBX依赖项:
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-extras</artifactId>
<version>1.2.5</version>
</dependency>
我还建议使用更新版本的JiBX,如1.2.5。
唐科利JiBX撰稿人。