1. 1. Include following configuration in pom.xml
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://jsr311.java.net/nonav/releases/1.1</link>
</links>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<show>public</show>
<!-- provide package information for webservicecs classes -->
<subpackages>com.abc.webservices</subpackages>
<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
<docletArtifacts>
<docletArtifact>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>wadl-resourcedoc-doclet</artifactId>
<version>${jersey-release-version}</version>
</docletArtifact>
<!--
Also specify jersey and xerces as doclet artifacts as the ResourceDoclet
uses classes provided by them to generate the resourcedoc.
-->
<docletArtifact>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-release-version}</version>
</docletArtifact>
<docletArtifact>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.1</version>
</docletArtifact>
</docletArtifacts>
<additionalparam>-output ${project.build.outputDirectory}/resourcedoc.xml</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>maven-wadl-plugin</artifactId>
<version>${jersey-release-version}</version>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<wadlFile>${project.build.outputDirectory}/application.wadl</wadlFile>
<formatWadlFile>true</formatWadlFile>
<baseUri>http://localhost:8080/api</baseUri>
<packagesResourceConfig>
<!-- provide package information for webservicecs classes -->
<param>com.abc.webservices</param>
</packagesResourceConfig>
<wadlGenerators>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
<properties>
<property>
<name>applicationDocsFile</name>
<value>${basedir}/src/main/resources/application-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-grammars.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport</className>
<properties>
<property>
<name>resourceDocFile</name>
<value>${project.build.outputDirectory}/resourcedoc.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
</wadlGenerators>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.outputDirectory}</dir>
<includes>
<include>application.wadl</include>
</includes>
<stylesheet>${basedir}/src/main/resources/wadl_documentation.xsl</stylesheet>
<outputDir>${project.build.directory}</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
2. Copy application-doc.xml, application-grammars.xml and wadl_documentation.xsl in src/main/resources directory
3. Run mvn clean install
0 comments:
Post a Comment