WSDL-URL的javamaven过滤
我正在尝试使用资源过滤为wsdl生成SOAP地址。但不知何故,它不起作用。我将插件和资源元素编写为:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>process-urls</id>
<phase>clean</phase>
<goals>
<goal>resources</goal>
</goals>
<inherited>false</inherited>
<configuration>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
<filters>
<filter>src/main/resources/PO/WSDLFiles/ProcessOrder.wsdl</filter>
<filter>src/main/resources/DAC/WSDLFiles/InternalRequest.wsdl</filter>
</filters>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
<resources>
<resource>
<directory>src/main/resources/</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
我在${protocol}
、${fullhostname}
和${port}
下定义了一些配置文件值
我想要修改的WSDL标记如下:
<service name="ProcessOrderService">
<port name="ProcessOrderSoapHttpPort" binding="tns:ProcessOrderSoapHttpBinding">
<soap:address location="${protocol}://${fullhostname}:${port}/PO/services/ProcessOrderSoapHttpPort"/>
</port>
</service>
当我运行我的pom文件时,它也有一个CXF插件来生成类,我看到JAVA对象中的URL是通过以下方式生成的:
${protocol}://${fullhostname}:${port}/PO/services/ProcessOrderSoapHttpPort
它只是按原样拾取字符串,没有应用任何值。你能告诉我我做错了什么吗?我猜WSDL属性中的“”是导致问题的原因,但我可能错了
# 1 楼答案
我假设Maven资源插件按预期工作。如果使用调试模式
mvn clean install -X
,您将发现一些其他信息,如:如果未指定
<outputDirectory>
,则默认输出文件夹将为${project.build.outputDirectory}
(目标/类)在这种情况下,只需在CXF插件中指定wsdl文件位置:
不要使用同一目录,因为您将丢失原始文件的内容。结果将是一个空的wsdl文件
此外,我建议修复资源插件配置。您可以使用
<filters>
来定义包含键值对的属性文件。使用<resources>
和<include>
代替您在构建部分中所做的操作