使用maven从WSDL生成jar

时间:2015-08-18 13:32:57

标签: maven wsdl pom.xml axis wsdl2java

我在maven脚本中有一个插件,插件使用ant文件导入wsdl,然后生成该WSDL的存根。存根正在成功生成,但我也想生成一个jar文件。这是我的插件

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
                  <execution>
                        <id>run_inovoke_wsdlgen</id>
                        <phase>compile</phase>
                        <goals>
                              <goal>run</goal>
                        </goals>
                        <configuration>
                              <target name="handle_wsdl_import" description="Handle WSDL Import" >
                                    <ant antfile="C:\Users\chashish\Desktop\yogesh\WsdlImportAnt.xml" target="generate" inheritAll="false" >
                                    </ant>
                              </target>
                              <jvmArgs>
                                    <jvmArg>-Xmx1024m</jvmArg>
                                    <jvmArg>-Xms256m</jvmArg>
                              </jvmArgs>
                        </configuration>
                  </execution>
            </executions>
            <dependencies>
                  <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>1.7</version>
                        <scope>system</scope>
                        <systemPath>${toolsjar}</systemPath>
                  </dependency>
            </dependencies>
      </plugin>

这是WSDLImport.xml文件

<?xml version="1.0"?>
<project name="WSDL2JavaExample" default="generate" basedir=".">

    <property name="wsdlurl" value="C:\path_to_service\ScheduleService.wsdl" />
    <property name="gensrc" value="C:\temp\wsdlimport\" />

    <path id="axis.path">
        <pathelement location="C:\Users\chashish\workspace\some_jars.jar" />
        <pathelement location="C:\Users\chashish\workspace\some_jars.jar" />
        ....
    </path>

    <target name="generate" >
    <java classname="org.apache.axis.wsdl.WSDL2Java" fork="true">
        <classpath>
        <path refid="axis.path" />
      </classpath>
      <arg line="--wrapArrays --output ${gensrc} ${wsdlurl}" />
    </java>
    </target>

</project>

由于

0 个答案:

没有答案