How To Generate Wadl Via Maven Plugin

So you've written your spider web service together with would forthwith desire to practice the wadl for it.

 Assuming you lot accept your spider web projection inward eclipse amongst maven integrated this is what you lot accept to do: 1.) Add the lines below to your pom, you lot may desire to practice it's ain profile. For event api.
<plugin>  <groupId>com.sun.jersey.contribs</groupId>  <artifactId>maven-wadl-plugin</artifactId>  <version>1.18.3</version>  <executions>   <execution>    <id>generate</id>    <goals>     <goal>generate</goal>    </goals>    <phase>compile</phase>   </execution>  </executions>  <configuration>   <wadlFile>${project.build.directory}/docs/application.wadl</wadlFile>   <formatWadlFile>true</formatWadlFile>   <baseUri>http://czetsuya-tech.blogspot.com/api/rest</baseUri>   <packagesResourceConfig>    <param>com.broodcamp.api.rest</param>   </packagesResourceConfig>   <wadlGenerators>    <wadlGeneratorDescription>     <className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc     </className>     <properties>      <property>       <name>applicationDocsFile</name>       <value>${project.basedir}/src/main/resources/application-wadl-doc.xml</value>      </property>     </properties>    </wadlGeneratorDescription>    <wadlGeneratorDescription>     <className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport     </className>     <properties>      <property>       <name>grammarsFile</name>       <value>${basedir}/src/main/resources/application-wadl-grammar.xml</value>      </property>     </properties>    </wadlGeneratorDescription>   </wadlGenerators>  </configuration> </plugin> 

2.) Looking at the plugin configuration above, nosotros forthwith accept ii define ii files:
application-wadl-doc.xml
<?xml version="1.0" encoding="UTF-8"?> <applicationDocs targetNamespace="http://wadl.dev.java.net/2009/02">  <doc xml:lang="en" title="How to generate wadl via maven plugin">czetsuya-tech api</doc> </applicationDocs> 

application-wadl-grammar.xml
<?xml version="1.0" encoding="UTF-8" ?> <grammars xmlns="http://wadl.dev.java.net/2009/02" /> 

3.) Now all you lot need to practice is run the ascendancy below inward ascendancy prompt:
>mvn -Papi laid upward clean compile com.sun.jersey.contribs:maven-wadl-plugin:generate // authorities annotation that nosotros role api profile equally defined above. 
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.