在不同模块上的cxf-codegen-plugin中选择wsdlArtifact

时间:2015-03-13 13:00:24

标签: java maven wsdl cxf-codegen-plugin

maven上的cxf-codegen-plugin有一种奇怪的行为。

一些信息:

一个父母pom(称为PARENT),有3个孩子:SERVICE,CLIENT1,CLIENT2。

该服务从两个类开始生成由两个分类器描述的两个wsdl。 SERVICE pom.xml是:

<plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-java2ws-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-client-first</id>
                    <phase>process-classes</phase>
                    <configuration>
                        <classifier>first</classifier>
                        <className>com.CLASS1</className>
                        <genWsdl>true</genWsdl>
                        <verbose>true</verbose>
                        <attachWsdl>true</attachWsdl>
                    </configuration>
                    <goals>
                        <goal>java2ws</goal>
                    </goals>
                </execution>
                <execution>
                    <id>generate-client-second</id>
                    <phase>process-classes</phase>
                    <configuration>
                        <classifier>second</classifier>
                        <className>com.CLASS2</className>
                        <genWsdl>true</genWsdl>
                        <verbose>true</verbose>
                        <attachWsdl>true</attachWsdl>
                    </configuration>
                    <goals>
                        <goal>java2ws</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

CLIENT1和2从SERVICE中生成的分类wsdl开始生成两个java客户端。因此CLIENT1 pom.xml

  <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <executions>
      <execution>
        <id>generate-sources-client1</id>
        <phase>generate-sources</phase>
        <configuration>
          <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
          <wsdlOptions>
            <wsdlOption>
              <wsdlArtifact>
                <groupId>com.something</groupId>
                <artifactId>artifact</artifactId>
                <version>${project.version}</version>
                <classifier>first</classifier>
              </wsdlArtifact>
            </wsdlOption>
          </wsdlOptions>
          <defaultOptions>
            <faultSerialVersionUID>FQCN</faultSerialVersionUID>
          </defaultOptions>
        </configuration>
        <goals>
          <goal>wsdl2java</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

CLIENT2 pom.xml

  <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <executions>
      <execution>
        <id>generate-sources-client2</id>
        <phase>generate-sources</phase>
        <configuration>
          <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
          <wsdlOptions>
            <wsdlOption>
              <wsdlArtifact>
                <groupId>com.something</groupId>
                <artifactId>artifact</artifactId>
                <version>${project.version}</version>
                <classifier>second</classifier>
              </wsdlArtifact>
            </wsdlOption>
          </wsdlOptions>
          <defaultOptions>
            <faultSerialVersionUID>FQCN</faultSerialVersionUID>
          </defaultOptions>
        </configuration>
        <goals>
          <goal>wsdl2java</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

只运行CLIENT2 pom( mvn -U clean install )一切正常,只要运行目标 mvn -U generate- PARENT pom上的消息来源

问题出现在父pom上运行: mvn -U clean install ,因为没有生成第二个客户端:实际上它&#34;解析&#34;总是第一个wsdl:

[INFO] ------------------------------------------------------------------------
[INFO] Building client2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ client2 ---
[INFO] Deleting /home/developer/workspace/PARENT/CLIENT2/target
[INFO] 
[INFO] --- cxf-codegen-plugin:3.0.4:wsdl2java (generate-sources) @ client2 ---
[INFO] com.something:artifact:wsdl:first:1.0-SNAPSHOT resolved to /home/.../Class1.wsdl
[INFO] Resolved WSDL artifact to file /home/.../Class1.wsdl

问题与this不同,因为在这种情况下,单个构建中有2个执行。最后两个信息: 1)我在本地有这个问题,而在詹金斯一切正常。 2)Maven版本

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /opt/develop/apache-maven/apache-maven-3.2.5
Java version: 1.8.0_31, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_31/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"
你能帮帮我吗?

非常感谢!

0 个答案:

没有答案