2016-12-01 4 views
1

私のプロジェクトをAntからMavenに変換しようとしています。Ant wsdl2javaからMavenへwsdl2java convertion

私のプロジェクトでは、TestServiceWSDL_TestServiceV1Http_Service.wsdlという名前のwsdlがあります。

私はAntビルド(軸-WSDL2Javaの)を使用する場合、それは以下のようなクラスを生成します。

TestServiceWSDL_TestServiceV1HttpBindingStub.java 
TestServiceWSDL_TestServiceV1HttpService.java 
TestServiceWSDL_TestServiceV1HttpServiceLocator.java 

私はMavenのに変換するとき、私はそれは以下のようにクラスを生成することを参照してください。

TestServiceV1_TestServiceWSDLTestServiceV1HttpPort_Client.java 
TestServiceV1_TestServiceWSDLTestServiceV1HttpPort_Server.java 
TestServiceWSDLTestServiceV1HttpService.java 

私のプロジェクトをMavenビルドを使用して変換し、同じ名前のクラスを生成するにはどうすればよいですか?

使用

のAntコマンド:

<target name="wsdl2java"> 
    <axis-wsdl2java output="${gen.dir}" testcase="false" verbose="false" url="wsdl.url"> 
     <mapping namespace="namespace.from.wsdl.1" package="package.1" /> 
     <mapping namespace="namespace.from.wsdl.2" package="package.2" /> 
    </axis-wsdl2java> 
</target> 

のMavenプラグイン:私はCXF-codegenを-プラグインを使用して解決策を見つけることができませんでしたが、使用して、今それを解決してきた

<plugin> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-codegen-plugin</artifactId> 
    <version>3.1.0</version> 
    <executions> 
     <execution> 
      <id>generate-sources</id> 
      <phase>generate-sources</phase> 
      <configuration> 
       <sourceRoot>target/generated/src/main/java</sourceRoot> 
       <wsdlOptions> 
        <wsdlOption> 
         <wsdl>ws/TestServiceWSDL_TestServiceV1Http_Service.wsdl</wsdl> 
         <extraargs> 
          <extraarg>-client</extraarg> 
          <extraarg>-server</extraarg> 
          <extraarg>-verbose</extraarg> 
          <extraarg>-p</extraarg> 
          <extraarg>namespace.1=package.1</extraarg> 
          <extraarg>-p</extraarg> 
          <extraarg>namespace.2=package.2</extraarg> 
         </extraargs> 
        </wsdlOption> 
       </wsdlOptions> 
      </configuration> 
      <goals> 
       <goal>wsdl2java</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <defaultOptions> 
      <autoNameResolution>true</autoNameResolution> 
     </defaultOptions> 
     <extension>true</extension> 
     <args> 
      <arg>-npa</arg> 
     </args> 
    </configuration> 
</plugin> 

答えて

1

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <executions> 
     <execution> 
      <id>generate-sources</id> 
      <phase>generate-sources</phase> 
      <configuration> 
       <sourceRoot>target/generated/src/main/java</sourceRoot> 
       <tasks> 
        <taskdef resource="axis-tasks.properties" classpathref="maven.compile.classpath" /> 
        <mkdir dir="target/generated/src/main/java" /> 
        <axis-wsdl2java output="target/generated/src/main/java" testcase="false" 
         verbose="false" 
         url="ws/TestServiceLookupWSDL_TestServiceLookupV1Http_Service.wsdl"> 
         <mapping namespace="namespace.1" 
          package="package.1" /> 
         <mapping namespace="namespace.2" 
          package="package.2" /> 
        </axis-wsdl2java> 
       </tasks> 
      </configuration> 
      <goals> 
       <goal>run</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
関連する問題