Friday, June 20, 2014

maven jaxws plugin simple configuration wsimport

Below is a simple configuration for the jaxws-maven-plugin. The trick is to get the jaxws plugin to generate the java sources at the right time and in the right place so that the maven-compiler-plugin with its default settings can find the files when it needs them.

Configuring the jaxws plugging so that it executes the wsimport goal at the right time is done by the phase entry.

Making sure that the plugin puts the files in the right location is accomplished by the sourceDestDir element.

The only the that needs to be modified is the wsdlUrl entry and the finalName elements.

..

<build>

   <finalName>web-app</finalName>

   <plugins>
      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>jaxws-maven-plugin</artifactId>
         <version>1.12</version>
            <executions>
               <execution>               
                  <phase>generate-sources</phase>
                  <goals><goal>wsimport</goal></goals>
                  <configuration>
                     <wsdlUrls>
                        <wsdlUrl>http://hostname/context/SDMXQuery?wsdl</wsdlUrl>
                     </wsdlUrls>
                     <sourceDestDir>${project.build.directory}/generated-sources</sourceDestDir>
                  </configuration>
            </execution>
         </executions>
      </plugin>
   </plugins>

</build>

..





No comments:

Post a Comment