no

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 fi...

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

javaee-rest 8186783131898016454

Post a Comment Default Comments

Outsourcing

Are you looking for freelancers in the Philippines? Get in touch.

Donations

If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.

item