java 使用 CXF 从 Maven 生成 WSDL2Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15293830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generating WSDL2Java from Maven with CXF
提问by
For e.g. I have cxf-codegen-plugin like this:
例如,我有这样的 cxf-codegen-plugin:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-jaxb</id>
<phase>generate-sources</phase>
<configuration>
<additionalJvmArgs>-Dfile.encoding=UTF8</additionalJvmArgs>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/MyWsdl.wsdl</wsdl>
<extraargs>
<extraarg>-wsdlLocation</extraarg>
<extraarg></extraarg>
<extraarg>-client</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
It is working just fine when my WSDl is stored in my local project:
当我的 WSDl 存储在我的本地项目中时,它工作得很好:
src/main/resources/wsdl/MyWsdl.wsdl
What I am trying to achieve is to download the WSDL from remote Maven repository and pass it somehow to the <wsdl>
element.
我想要实现的是从远程 Maven 存储库下载 WSDL 并将其以某种方式传递给<wsdl>
元素。
Something like:
就像是:
<wsdl>
<dependency>...</dependency>
</wsdl>
I can't find any information about how to do this. Does the option like this even exists? Or it should be done somehow differently then trying to pass the WSDL in the <wsdl>
element?
我找不到有关如何执行此操作的任何信息。这样的选择是否存在?或者它应该以某种不同的方式完成,然后尝试在<wsdl>
元素中传递 WSDL ?
Please advice.
请指教。
回答by Anders R. Bystrup
You can use the <wsdlArtifact>
to load the WSDL from maven:
您可以使用<wsdlArtifact>
来从 maven 加载 WSDL:
<configuration>
...
<wsdlOptions>
<wsdlOption>
<wsdlArtifact>
<groupId>your.group.id</groupId>
<artifactId>YourWSDLService</artifactId>
<version>0.1.2-SNAPSHOT</version>
</wsdlArtifact>
</wsdlOption>
</wsdlOptions>
...
</configuration>