1

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 生成,该路径显然在服务器上失败。为什么?

4

1 回答 1

0

经过多次诅咒后我发现的工作配置是:

project: 
 build: 
  plugins: 
   plugin: 
    executions: 
     execution: 
      id: "generate-common-sources"
      configuration: 
       wsdlOptions: # Keep this empty!
 profiles: 
  profile: 
   id: "env-test"
   build: 
    plugins: 
     plugin: 
      executions: 
       execution: 
        id: "generate-test-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"
           - 
            wsdl: "${project.basedir}/src/main/resources/wsdl/Service3-test.wsdl"
            wsdlLocation: "/wsdl/Service3-test.wsdl"
  profile:
   id: "env-prod"
   build:
    # Duplicate env-test here

仍然不清楚为什么我的第一种方法不起作用。

于 2017-03-14T17:40:08.627 回答