如果我理解正确,您只想提供正确 WSDL 文件的路径。请参阅cxf-codgen 插件中的以下示例。
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
此处 WSDL 的路径仅由basedir
修改,您可以将该行修改为:
...
<wsdl>${basedir}/${myRelativePath}/myService.wsdl</wsdl>
...
正如您所提到的,您可以使用properties-maven-plugin读取的路径。问题是加载正确的属性文件。这可以使用配置文件来完成。
<profiles>
<profile>
<id>fitnesse</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>maven-properties-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profiles>
如果所有属性只影响 wsdl 文件,那么您可以在配置文件中配置正确 wsdl 文件的路径,这样就不需要属性文件了。
以防万一,我完全误解了你,你只想知道,如何从属性文件中读取属性到 wsdl (xml) 文件中,然后看看maven-config-processor-plugin,语法用于更改 xml 文件的内容可在转换配置页面上找到