CXF maven 插件在错误的目录中生成类
我正在使用 maven cxf-codegen-plugin 从 wsdl 生成 java web 服务文件。 如果我尝试在默认输出目录中生成文件,该插件可以正常工作 (目标\生成源\cxf), 但如果我尝试在其他目录中生成它们,方法是:
<sourceRoot>src/main/myOtherDir</sourceRoot>
在我的 pom.xml 中, 如果我这样做,则仅生成文件:
mvn clean eclipse:eclipse
如果我
mvn eclipse:eclipse
不使用“clean”,则不会生成文件...
有人知道吗...?
我的pom:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<configuration>
<sourceRoot>src/main/myOtherDir</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/AccountWS.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
谢谢, 阿隆
I'm using maven cxf-codegen-plugin to generate java web service files from wsdl.
The plugin works fine if I'm trying to generate the files in the default output directory
(target\generated-sources\cxf),
but if I'm trying to generate them in other directory by using:
<sourceRoot>src/main/myOtherDir</sourceRoot>
in my pom.xml,
the files are generated only if I do:
mvn clean eclipse:eclipse
If I do
mvn eclipse:eclipse
without 'clean' the files are not generated...
Does anyone have any idea....?
My pom:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<configuration>
<sourceRoot>src/main/myOtherDir</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/AccountWS.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Thanks,
Alon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您最好将 sourceRoot 设置在目标目录下方,以便它与其他内容一起被清理,例如:
为了确保插件始终执行,您需要将其绑定到一个阶段,例如
You are better off setting the sourceRoot below the target directory so it is cleaned along with other content, e.g.:
To ensure the plugin always executes, you need to bind it to a phase, e.g.
好吧,我发现了这个问题,非常尴尬......
因为我没有更新 wsdl,所以插件没有生成文件...
无论如何,apache cfx 文档指出:
对于 CXF 2.1.4 及更高版本,您不再需要指定
,因为生成源是默认值。感谢您的帮助
Well I found the problem, Very embarrassing...
Because I didn't update the wsdl, the plugin did not generate the files...
Anyway, the apache cfx documentation states that:
For CXF 2.1.4 and latter you don't need anymore to specify the
<phase>
, as generate-sources is the default.Thanks for your help