How To Generate Jax-Rs Documentation Using Maven

To generate the jax-rs documentation automatically using maven, nosotros quest to add together closed to plugins inwards the ready department of the project's pom file.

To avoid running this plugin every fourth dimension you lot invoke mvn install, you lot tin flame practise a carve upwards 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="How to generate jax-rs documentation using maven" />   <c disabled="true" />   <csharp disabled="true" />   <obj-c disabled="true" />  </modules> </enunciate> 
Next
Previous
Click here for Comments

0 komentar:

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