繁体   English   中英

jaxws-maven-plugin 多次执行不起作用

[英]jaxws-maven-plugin multiple executions not working

我想为多个 WSDL 生成 java 类。 由于不同模式中的名称冲突,每个 WSDL 应该在一个 java 包中。 我在 pom.xml 中创建了以下执行:

  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jaxws-maven-plugin</artifactId>
      <version>2.5</version>
      <executions>
        <execution>
          <id>service1</id>
          <goals>
            <goal>wsimport</goal>
          </goals>
          <configuration>
            <wsdlUrls>
              <wsdlUrl>http://myserver/service1?wsdl</wsdlUrl>
            </wsdlUrls>
            <keep>false</keep>
            <sourceDestDir>target/generatedclasses</sourceDestDir>
            <packageName>com.myservice1</packageName>
          </configuration>
        </execution>
        <execution>
          <id>service2</id>
          <goals>
            <goal>wsimport</goal>
          </goals>
          <configuration>
            <wsdlUrls>
              <wsdlUrl>http://myserver/service2?wsdl</wsdlUrl>
            </wsdlUrls>
            <keep>false</keep>
            <sourceDestDir>target/generatedclasses</sourceDestDir>
            <packageName>com.myservice2</packageName>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

但显然找不到WSDL位置:

[DEBUG] Configuring mojo org.codehaus.mojo:jaxws-maven-plugin:2.5:wsimport from plugin realm ClassRealm[plugin>org.codehaus.mojo:jaxws-maven-plugin:2.5, parent: sun.misc.Launcher$AppClassLoader@18b4aac2]
[DEBUG] Configuring mojo 'org.codehaus.mojo:jaxws-maven-plugin:2.5:wsimport' with basic configurator -->
[DEBUG]   (f) bindingDirectory = C:\sandbox\ws-client\src\jaxws
[DEBUG]   (f) destDir = C:\sandbox\ws-client\target\classes
[DEBUG]   (f) extension = false
[DEBUG]   (f) genJWS = false
[DEBUG]   (f) implDestDir = C:\sandbox\ws-client\src\main\java
[DEBUG]   (f) keep = true
[DEBUG]   (f) pluginDescriptor = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'org.codehaus.mojo.jaxws.HelpMojo', role hint: 'org.codehaus.mojo:jaxws-maven-plugin:2.5:help'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.codehaus.mojo.jaxws.MainWsGenMojo', role hint: 'org.codehaus.mojo:jaxws-maven-plugin:2.5:wsgen'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.codehaus.mojo.jaxws.TestWsGenMojo', role hint: 'org.codehaus.mojo:jaxws-maven-plugin:2.5:wsgen-test'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.codehaus.mojo.jaxws.MainWsImportMojo', role hint: 'org.codehaus.mojo:jaxws-maven-plugin:2.5:wsimport'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.codehaus.mojo.jaxws.TestWsImportMojo', role hint: 'org.codehaus.mojo:jaxws-maven-plugin:2.5:wsimport-test'
---
[DEBUG]   (f) project = MavenProject: org.example:wsclient:1.0-SNAPSHOT @ C:\sandbox\ws-client\pom.xml
[DEBUG]   (f) quiet = false
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@22680f52
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter@39c11e6c
[DEBUG]   (f) sourceDestDir = C:\sandbox\ws-client\target\generated-sources\wsimport
[DEBUG]   (f) staleFile = C:\sandbox\ws-client\target\jaxws\stale
[DEBUG]   (f) useJdkToolchainExecutable = false
[DEBUG]   (f) verbose = false
[DEBUG]   (f) wsdlDirectory = C:\sandbox\ws-client\src\wsdl
[DEBUG]   (f) xadditionalHeaders = false
[DEBUG]   (f) xdebug = false
[DEBUG]   (f) xdisableAuthenticator = false
[DEBUG]   (f) xdisableSSLHostnameVerification = false
[DEBUG]   (f) xnoAddressingDataBinding = false
[DEBUG]   (f) xnocompile = true
[DEBUG]   (f) xuseBaseResourceAndURLToLoadWSDL = false
[DEBUG] -- end configuration --
[DEBUG] The wsdl Directory is C:\sandbox\ws-client\src\wsdl
[INFO] No WSDLs are found to process, Specify at least one of the following parameters: wsdlFiles, wsdlDirectory or wsdlUrls.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.808 s

我不明白,为什么这个例子不起作用。 似乎配置是有效的(参见Multiple WSDLs Configurations With Maven JAXWS

如果我将configuration元素向上移动两级,它就可以工作! (但我只能配置一个执行...)

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jaxws-maven-plugin</artifactId>
      <version>2.5</version>
      <executions>
        <execution>
          <goals>
            <goal>wsimport</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <wsdlUrls>
          <wsdlUrl>http://myserver/service1?wsdl</wsdlUrl>
        </wsdlUrls>
        <keep>false</keep>
        <sourceDestDir>target/generatedclasses</sourceDestDir>
        <packageName>com.myservice1</packageName>
      </configuration>
    </plugin>
  </plugins>
</build>

任何解决方案的想法都非常感谢!

(PS Java 8, Maven 3.6.2)

解决方案是运行“安装”生命周期而不是直接运行插件 jaxws:import。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM