How to generate jax-rs documentation using maven

To generate the jax-rs documentation automatically using maven, we need to add some plugins in the build section of the project's pom file.

To avoid running this plugin every time you invoke mvn install, you can create a separate profile for it.

Here's the plugin definition:

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<versionRange>[1.29,)</versionRange>
<goals>
<goal>docs</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.29</version>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
<configuration>
<docsDir>${project.build.directory}/docs</docsDir>
<configFile>src/main/resources/enunciate.xml</configFile>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/generated-resources/schemagen/</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources/</directory>
<includes>
<include>jaxb.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</pluginManagement>
</build>

And here's the content of enunciate.xml.
<?xml version="1.0"?>
<enunciate label="novaglobalapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.25.xsd">

<api-classes>
<include pattern="org.broodcamp.api.rest.**" />
</api-classes>

<modules>
<docs docsDir="restapi" title="Broodcamp REST API" />
<c disabled="true" />
<csharp disabled="true" />
<obj-c disabled="true" />
</modules>
</enunciate>

Related Posts:

  • Enable HTTPS / SSL for WildflyHere are the steps I run through to enable SSL / HTTPS for Wildfly 14.Notice that instead of generating a key / certificate pair we instead use a spec… Read More
  • Install Java8 in UbuntuA set of commands to install Java8 on Ubuntu.sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installe… Read More
  • Hadoop MapReduce DemoVersions:Hadoop 3.1.1 Java10Set the following environment variables:JAVA_HOME HADOOP_HOMEFor WindowsDownload Hadoop 3.1.1 binaries for windo… Read More
  • Microservices in SpringAnd so I was trying to learn microservices and since I'm from the JavaEE background it's given that I will first check: http://wildfly-swarm.io/t… Read More
  • Social Login using REST FBThis is an implementation tutorial on how we can use REST FB to enable facebook social login on our web application.Basically, it's a project created … Read More

0 nhận xét:

Đăng nhận xét