<?xml version="1.0" encoding="UTF-8"?>
<!--
  The contents of this file are subject to the terms of the Common Development and
  Distribution License (the License). You may not use this file except in compliance with the
  License.

  You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
  specific language governing permission and limitations under the License.

  When distributing Covered Software, include this CDDL Header Notice in each file and include
  the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
  Header, with the fields enclosed by brackets [] replaced by your own identifying
  information: "Portions Copyright [year] [name of copyright owner]".

  Copyright 2014-2016 ForgeRock AS.
-->
<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">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>openig-project</artifactId>
    <groupId>org.openidentityplatform.openig</groupId>
    <version>6.1.1</version>
  </parent>

  <artifactId>openig-doc</artifactId>

  <name>OpenIG doc</name>
  <description>
    Documentation samples and aggregated Javadoc
  </description>

  <dependencies>
    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>util</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>json</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-csv</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-syslog</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-jdbc</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>json-resource</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>json-resource-http</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>servlet</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-core</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-oauth2</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-openam</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-saml</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-uma</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.grizzly</groupId>
      <artifactId>grizzly-http-server</artifactId>
    </dependency>

    <dependency>
      <groupId>net.sourceforge.htmlunit</groupId>
      <artifactId>htmlunit</artifactId>
      <version>2.70.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>sample-server</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/jar-with-dependencies-assembly.xml</descriptor>
              </descriptors>
              <archive>
                <manifest>
                  <addClasspath>true</addClasspath>
                  <mainClass>org.forgerock.openig.doc.SampleApplication</mainClass>
                </manifest>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>port-allocator-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>allocate-ports</goal>
            </goals>
            <configuration>
              <ports>
                <port>
                  <name>port</name>
                </port>
                <port>
                  <name>sslPort</name>
                </port>
              </ports>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Run the tests with the Failsafe plugin, not the Surefire plugin. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <serverPort>${port}</serverPort>
            <serverSslPort>${sslPort}</serverSslPort>
          </systemPropertyVariables>
          <includes>
            <include>**/*.java</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>forgerock-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <!-- Do not change this execution's ID:
                     It needs to be in sync with what appears in the forgerock-parent POM -->
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
            <configuration>
              <skip>false</skip>

              <!-- The content of site/apidocs gets squashed during reporting. -->
              <outputDirectory>${project.build.directory}/site/javadoc</outputDirectory>

              <!-- Aggregates javadocs from dependencies -->
              <includeDependencySources>true</includeDependencySources>
              <includeTransitiveDependencySources>true</includeTransitiveDependencySources>
              <dependencySourceIncludes>
                <dependencySourceInclude>org.openidentityplatform.openig:*</dependencySourceInclude>
                <dependencySourceInclude>org.openidentityplatform.http:*</dependencySourceInclude>
                <dependencySourceInclude>org.openidentityplatform.commons:*</dependencySourceInclude>
              </dependencySourceIncludes>

              <author>false</author>
              <doctitle>OpenIG ${project.version} API</doctitle>
              <header>OpenIG ${project.version} API</header>
              <footer>OpenIG ${project.version} API</footer>
              <bottom>Copyright 2011-2015 ForgeRock AS.</bottom>
              <links>
                <link>http://docs.oracle.com/javase/7/docs/api/</link>
              </links>

              <!-- Defines groups of packages for the overview page -->
              <groups>
                <group>
                  <title>ForgeRock OpenIG</title>
                  <packages>org.forgerock.openig*</packages>
                </group>
                <group>
                  <title>ForgeRock Commons Audit</title>
                  <packages>org.forgerock.audit*</packages>
                </group>
                <group>
                  <title>ForgeRock Http Framework</title>
                  <packages>org.forgerock.http*</packages>
                </group>
                <group>
                  <title>ForgeRock Utilities</title>
                  <packages>org.forgerock.util*:org.forgerock.json*</packages>
                </group>
              </groups>

              <!-- Excludes internal packages from the javadoc generation -->
              <excludePackageNames>com.*:*.internal</excludePackageNames>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>man-pages</id>
      <activation>
        <os>
          <family>unix</family>
          <name>Linux</name>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.openidentityplatform.commons</groupId>
            <artifactId>doc-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>build-man-pages-asciidoc</id>
                <phase>package</phase>
                <goals>
                  <goal>asciidoc-pre-process</goal>
                  <goal>antora</goal>
                  <goal>asciidoc-to-pdf</goal>
                </goals>
                <configuration>
                  <documents>
                    <document>gateway-guide</document>
                     <document>reference</document>
                  </documents>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <projectName>OpenIG</projectName>
              <projectVersion>${project.version}</projectVersion>
              <releaseVersion>${project.version}</releaseVersion>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
