Java SOAP 网络应用程序。我有几项服务要查询,我必须根据环境(测试、产品)区分其中一项。我认为将通用 WSDL 保持在一起并为需要区分的服务创建两个配置文件是一种逻辑。不幸的是,我无法在运行时以编程方式更改 WSDL_LOCATION。所以我写了(将 XML 简化为 YAML 并删除明显的元素,例如<phase>generate-sources</phase>
):
project:
build:
plugins:
plugin:
executions:
execution:
id: "generate-common-sources"
configuration:
wsdlOptions:
wsdlOption:
-
wsdl: "${project.basedir}/src/main/resources/wsdl/Service1.wsdl"
wsdlLocation: "/wsdl/Service1.wsdl"
-
wsdl: "${project.basedir}/src/main/resources/wsdl/Service2.wsdl"
wsdlLocation: "/wsdl/Service2.wsdl"
profiles:
profile:
id: "env-test"
build:
plugins:
plugin:
executions:
execution:
id: "generate-test-sources"
configuration:
wsdlOptions:
wsdlOption:
wsdl: "${project.basedir}/src/main/resources/wsdl/Service3-test.wsdl"
wsdlLocation: "/wsdl/Service3-test.wsdl"
profile:
id: "env-prod"
build:
# Duplicate env-test here
但这不起作用:Service1 和 Service2 使用完整路径 WSDL_LOCATION 生成,该路径显然在服务器上失败。为什么?