<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ RHQ Management Platform
  ~ Copyright (C) 2005-2012 Red Hat, Inc.
  ~ All rights reserved.
  ~
  ~ This program is free software; you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation version 2 of the License.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with this program; if not, write to the Free Software
  ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>rhq-helpers</artifactId>
    <groupId>org.rhq.helpers</groupId>
    <version>4.6.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.rhq.helpers</groupId>
  <artifactId>rest-docs-generator</artifactId>
  <packaging>jar</packaging>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <defaultGoal>install</defaultGoal>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <plugins>

      <plugin>
        <groupId>org.bsc.maven</groupId>
        <artifactId>maven-processor-plugin</artifactId>
        <version>2.0.6-redhat</version>
        <configuration>
          <processors>
            <processor>org.rhq.helpers.rest_docs_generator.ClassLevelProcessor</processor>
          </processors>
          <compilerArguments>-AtargetDirectory=${project.build.directory}/docs/xml</compilerArguments>
          <!-- comment in next line to get the xml on stdout for debugging -->
            <!--<compilerArguments>-Averbose=true</compilerArguments>-->
        </configuration>
        <executions>
          <execution>
            <id>create-rest-api-report</id>
            <phase>process-classes</phase>
            <goals>
              <!-- We want to process the classes in test/ -->
              <goal>process-test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Disable annotation processors during normal compilation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgument>-proc:none</compilerArgument>
        </configuration>
      </plugin>
      <!-- now xml translate the output from above to html -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>transform</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <transformationSets>
            <transformationSet>
              <!-- target dir from -AtargetDirectory=... above -->
              <dir>target/docs/xml</dir>
              <stylesheet>src/main/xsl/apiout2html.xsl</stylesheet>
              <outputDir>${project.build.directory}/docs/html</outputDir>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                  <targetExtension>.html</targetExtension>
                </fileMapper>
              </fileMappers>
            </transformationSet>
          </transformationSets>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <!-- TODO temporary for the swagger annotations -->
      <id>sonatype-oss-snapshot</id>
      <name>Sonatype OSS Snapshot repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>

  </repositories>


  <dependencies>
    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>jsr311-api</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>javax.ejb</groupId>
      <artifactId>ejb-api</artifactId>
      <version>3.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.wordnik</groupId>
      <artifactId>swagger-annotations_2.9.1</artifactId>
      <version>1.1.1-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <version>${resteasy.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>${commons-logging.version}</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>