Quantcast
Channel: Planet Apache
Viewing all articles
Browse latest Browse all 9364

Sagara Gunathunga: Axis2 Simple HTTP server Maven plugin

$
0
0
As I mentioned in my last blog post this post covers one of the new feature of upcoming Axis2 1.7.0 version. Recently we have done number of improvements for Axis2 Maven support. There are three new Maven related modules introduced as follows.
  1.  simple-server-maven-plugin - A Maven plug-in that allows to run Axis2's simple HTTP server as a maven plug-in.
  2. quickstart archetype - Maven archetype to develop and package Axis2 native (AAR) web services.
  3. quickstart-webapp - Maven archetype to develop and package Axis2 web services as a web application(WAR).  
In this post I discuss how to use  simple-server-maven-plugin and it's configuration options. At the moment simple-server-maven-plugin provides  single goal as "axis2:run".

You can add simple-server-maven-plugin into your Maven POM file as follows.

     <plugin>  
         <groupId>org.apache.axis2</groupId>  
         <artifactId>simple-server-maven-plugin</artifactId>  
         <version>${axis2.version}</version>  
     </plugin>  

Note : At the moment this plug-in available only with 1.7.0-SNAPSHOT version and until this get released with official Apache releases you have to do one extra step as mentioned here[1].

As you may know Axis2 services expect single meta data file called services.xml under a directory named META-INF. By default it expect to place this meta data files under the "src/main/resources/services" directory. In order to deploy multiple service META-INF should place inside a another directory. As an example /src/main/resources/services/SimpleService/META-INF/services.xml. Also by default it facilitates to place Axis2 modules (.mar) under src/main/resources/modules directory. Following picture shows one such a example directory structure.

Once you have completed above steps you can run Axis2 Simple HTTP server using run goal.

 mvn clean axis2:run  

Now It's possible to access available service listing  page by http://localhost:8080 URL.

simple-server-maven-plugin support for following configuration options.


Option
repoPath Path to Axis2 repository by default run goal creates Axis2 repository inside the project's target directory.
confPath Path to Axis2.xml configuration file.
stdServiceSrcDir Directory to place service meta (META-INF/services.xml) information. This directory supports multiple service deployment. Default value is "src/main/resources/services".
moduleSrcDir moduleSrcDir - Directory to place Axis2 modules (.mar) default value is "src/main/resources/modules"

Hope this plug-in save web service development time greatly and also this can be used to automate unit test easily. 




[1] - Since above plug-in still not available on official Maven repositories  it is required to add following SNAPSHOT repository to your POM file. But this is not required after Axis2 1.7.0 release.
    <pluginRepositories>  
           <pluginRepository>     
            <id>apache-snapshots</id>     
            <url>http://repository.apache.org/snapshots</url>  
           </pluginRepository>    
      </pluginRepositories>  







Viewing all articles
Browse latest Browse all 9364

Trending Articles