Axis2 Maven plugin problem

I need to make pom.xml to generate Axis2 client based on WSDL file. Originally code was developed for client generated by Ant.

I used axistools-maven-plugin to do that. However Maven plugin generates different code.

I think the problem is plugin configuration. But i can't find enough documentation or examples to configure the plugin to generate in the same manner as Ant script.

Ant configuration:

<target name="generate.client">
        <delete dir="${axis2.build}"/>
        <mkdir dir="${client.target}"/>
       
        <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true" classpathref="axis2.classpath">
            <arg line="-uri ${wsdl.uri}"/>
            <arg line="-s"/>
            <arg line="-l java"/>
            <arg line="-ns2p ./src/main/wsdl/namespace2package.mapping"/>
            <arg line="-p com.reuters.search2"/>
            <arg line="-d xmlbeans"/>
            <arg line="-o ${client.target}"/>
        </java>
    </target>

 

Maven plugin :

          <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>axistools-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <id>build_misc_wsdl</id>
                     
                      <goals>
                          <goal>wsdl2java</goal>
                      </goals>
                      <phase>generate-sources</phase>
                      <configuration>
                          <outputDirectory>${project.build.sourceDirectory}/main/java</outputDirectory>
                          <debug>true</debug>
                          <testCases>false</testCases>
                          <verbose>true</verbose>
                          <allElements>true</allElements>
                          <wsdlFiles>
                              <wsdlFile>Search_2.wsdl</wsdlFile>
                          </wsdlFiles>
                          <serverSide>false</serverSide>
                          <useEmitter>true</useEmitter>
                          <fileNamespaceToPackage>namespace2package.mapping</fileNamespaceToPackage>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
 

Comments

Way don't you use http://ws.apache.org/axis2/tools/1_2/maven-plugins/maven-wsdl2code-plugi... ? from axis

org.apache.axis2
axis2-wsdl2code-maven-plugin
1.2



wsdl2code




true

hello.test.myservice true
true

I am having problem with this plugin or any other - for some reason when generating WebService client sources, the sources being generated into "src/package_name" directory. NOT src/main/java.
Therefore i can't connect sources of my project to generated sources. Maven fails on compilation.

If you need standard jaxws client just use

jaxws-maven-plugin

<plugin>
<groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxws-maven-plugin</artifactId>
       <executions>
<execution>
<id>convertTemp</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlDirectory>
src/main/resources/com/acmeconvertTemp/wsdl
</wsdlDirectory>
<wsdlUrls>
  <url>http://www.webservicex.net/ConvertTemperature.asmx?WSDL</url>
</wsdlUrls>
<packageName>
   com.acme.webservices.convertTemp
</packageName>
<keep>true</keep>
</configuration>
</execution>
</executions>
<dependencies>
     <dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
        <version>1.0-MR1</version>
</dependency>
</dependencies>
</plugin>

You can set it using outputDirectory in plugin configuration

Itai - the "outputDirectory" doesn't work - the tree which produced has following structure outputDirectory/src/package_name
I'll try Marks' suggestion.

http://maven.apache.org/guides/mini/guide-using-ant.html

see first example
try place all ant stuff between "tasks" "/tasks" in example POM.
And then you need resolve classpath dependencies of your Ant target.

If that does no good(but it must), try second example - use ant's exec to run ant as executable from the maven,
then it should work as "forked", separated process.