WSDL2JAVA无法在Maven中设置extraarg

时间:2012-12-06 12:15:06

标签: maven ant wsdl migration wsdl2java

我从Ant迁移到Maven项目,我遇到的问题让我失望:

  1. 在我的Ant bild.xml中,我在wsdl2java中有以下args:

        <arg value="-ns2p" />
        <arg value="${wsdl-ns-binding}" />
    

    我想在我的pom.xml中做同样的事情。但它没有用!!无论我如何尝试.. 我做错了什么??? 这里是WSDL2Java插件定义的例子:

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.6.2</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <packageName>ru.domain.ws.services.persistence.etb.mortgage.axis2.jaxb.server</packageName>
                        <wsdlFile>${wsdl-home}/ETB_MortgagePersistence.wsdl</wsdlFile>
                        <outputDirectory>${basedir}/src/main/generated</outputDirectory>        
                        <flattenFiles>true</flattenFiles>
                        <databindingName>jaxbri</databindingName>
                        <overWrite>true</overWrite> 
                <!--    <namespaceToPackage> 
                            http://ws.domain.ru/persistence/ETB/mortgage/wsdl=ru.domain.ws.services.persistence.etb.mortgage.wsdl
                        </namespaceToPackage> -->
    
                        <wsdlOptions>
                            <wsdlOption>
                                 <extraargs>
                                    <extraarg>-ns2p</extraarg>
                                    <extraarg>http://ws.domain.ru/persistence/ETB/mortgage/wsdl=ru.domain.ws.services.persistence.etb.mortgage.wsdl</extraarg>  
                                 </extraargs>                                
                            </wsdlOption>
                        </wsdlOptions>
    
                        <options>
                            <property>
                                <name>bindingFileName</name>
                                <value>${jaxb-binding-path}</value>
                            </property>
                        </options> 
    
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.axis2</groupId>
                    <artifactId>axis2-jaxbri</artifactId>
                    <version>1.6.2</version>
                </dependency>
            </dependencies>
        </plugin>
    
  2. $ {wsdl-ns-binding}变量为http://ws.domain.ru/persistence/ETB/mortgage/wsdl=ru.domain.ws.services.persistence.etb.mortgage.wsdl

1 个答案:

答案 0 :(得分:0)

尝试此布局(在wsdlOptions中指定wsdl文件)

<plugin>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
        <version>1.6.2</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${basedir}/src/main/java</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${wsdl-home}/ETB_MortgagePersistence.wsdl</wsdl>
                        <extraargs>  
                            <extraarg>-ns2p</extraarg>  
                            <extraarg>http://ws.domain.ru/persistence/ETB/mortgage/wsdl=ru.domain.ws.services.persistence.etb.mortgage.wsdl</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>