首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JiBx Maven构建问题

JiBx Maven构建问题
EN

Stack Overflow用户
提问于 2011-05-18 03:55:29
回答 1查看 4.9K关注 0票数 0

我有一个pom.xml,我用它从模式生成源代码,并进行绑定和编译。

代码语言:javascript
复制
<!--  <plugin>
            <groupId>org.jibx</groupId>
            <artifactId>maven-jibx-plugin</artifactId>
            <version>1.2.1.1</version>
            <configuration>
            <directory>src/main/resources/schema</directory>
            </configuration>
            <executions>
            <execution>
            <goals>
            <goal>schema-codegen</goal>
            </goals>
            </execution>
            </executions>
            </plugin> -->
             <plugin>
            <groupId>org.jibx</groupId>
            <artifactId>maven-jibx-plugin</artifactId>
            <version>1.2.1.1</version>
            <configuration>
                <targetDirectory></targetDirectory>
                <directory>src/main/resources/jibx</directory>
                <includes>
                    <includes>*binding.xml</includes>
                </includes>
                <excludes>
                    <exclude>template-binding.xml</exclude>
                </excludes>
                <verbose>false</verbose>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>bind</goal>
                    </goals>
                </execution>
                <execution>
                    <id>compile-binding</id>
                </execution>

            </executions>
        </plugin> 

因此,当我尝试生成.java和binding.xml时,我取消了对的第一部分的注释,而对底部进行了注释。这将生成.java和binding.xml。现在,我将binding.xml复制到src/main/resources/jibx,将java类复制到com.models.response package。然后,我通过取消注释这些行并注释顶部来运行绑定和编译绑定目标。我可以在'target.com.models.response‘包中看到JiBX_bindingFactory.class和'JiBX_bindingResponse_access.class’。

问题是,当我运行一个测试类并试图将响应inputstream解组到"Response.class“中时,我得到了Exception in thread "main" org.jibx.runtime.JiBXException: JiBx Exception: Unable to access binding information for class com.models.response.Response Make sure the binding has been compiled错误。

请注意:我在Eclipse中完成了所有这些操作,默认的输出文件夹显示为'/build‘。我也尝试过将Jibx类复制粘贴到'build‘文件夹中。仍然面临着同样的问题。

请救命!

谢谢

EN

回答 1

Stack Overflow用户

发布于 2011-05-18 14:55:31

两件事。

注释和取消注释pom部分不是进行开发的理想方式。看起来您还没有将这些目标绑定到相关的maven生命周期阶段。例如,从schema-codegenprocess-resources

正如maven jibx插件documentation所指定的,对于测试,您需要运行以下适当的目标。

代码语言:javascript
复制
jibx:test-bind Runs the JiBX binding compiler on the test classes.
jibx:test-schema-codegen Generates Java test sources from XSD schemas.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6036345

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档