JAXB2-maven仅构建目标 [英] JAXB2-maven only builds in target

查看:102
本文介绍了JAXB2-maven仅构建目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行我的第一个Java-Spring项目。我需要与几个Web服务进行通信。我提供了一些WSDL,所以我使用Jax2B来自动生成类。

I'm on my first Java-Spring project. I need to communicate with a couple of webservices. I have some WSDL's provided, so i'm using Jax2B to autogenerate classes.

<plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.9.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <generatePackage>hello.wsdl</generatePackage>
                    <forceRegenerate>true</forceRegenerate>
                    <schemas>
                        <schema>
                            <url>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</url>
                        </schema>
                    </schemas>

                </configuration>
</plugin>

我的项目是一个网络项目。这里的问题是,我的类是在目标文件夹中生成的,而不是在我的项目中生成的。有人有想法如何解决这个问题?正确生成类,但不在正确的目录中生成。如您所见,我现在正在使用测试wsdl和模型名称。我遵循了本教程: http://spring.io/guides/gs/consuming-web -service /

My project is a web project. The problem here is, my classes are generated in the targets folder, and not in my project. Does somebody have ideas how to fix this? Classes are generated properly, but not at the proper directory. As you can see, i'm using a test wsdl and mockup names at the moment. I followed this tutorial: http://spring.io/guides/gs/consuming-web-service/

非常感谢提前

推荐答案

此处 maven-jaxb2-pugin 的作者。

target / generated-sources / xjc 是正确的目录。这就是在Maven构建中处理生成代码的方式,你永远不会在 src / main / java 中生成任何内容。

target/generated-sources/xjc IS the proper directory. This is how generated code is handled in Maven builds, you never generate anything into src/main/java.

maven-jaxb2-plugin 还将此目录添加到Maven的sources目录中。您只需确保IDE将此目录视为源目录。在Eclipse中,m2eclipse插件会在您执行更新项目时自动执行此操作。

The maven-jaxb2-plugin also adds this directory to the Maven's sources directories. You just have to make sure that this directory is considered a source directory by your IDE. In Eclipse, m2eclipse plugin does this automatically when you do "Update project".

请参阅这部分文档

这篇关于JAXB2-maven仅构建目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆