<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2018-present Sonatype, Inc. All rights reserved.

    This program is licensed to you under the Apache License Version 2.0,
    and you may not use this file except in compliance with the Apache License Version 2.0.
    You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.

    Unless required by applicable law or agreed to in writing,
    software distributed under the Apache License Version 2.0 is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.

-->
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.sonatype.buildsupport</groupId>
    <artifactId>public-parent</artifactId>
    <version>15</version>
    <relativePath/>
  </parent>

  <groupId>org.sonatype.ossindex</groupId>
  <artifactId>ossindex-service</artifactId>
  <name>${project.groupId}:${project.artifactId}</name>
  <packaging>pom</packaging>

  <version>1.3.0</version>

  <url>https://sonatype.github.io/ossindex-public/</url>

  <scm>
    <connection>scm:git:git://github.com/sonatype/ossindex-service.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/sonatype/ossindex-service.git</developerConnection>
    <url>https://github.com/sonatype/ossindex-service</url>
  </scm>

  <inceptionYear>2018</inceptionYear>

  <licenses>
    <license>
      <name>ASL2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <issueManagement>
    <system>github</system>
    <url>https://github.com/sonatype/ossindex-public/issues</url>
  </issueManagement>

  <ciManagement>
    <system>jenkins</system>
    <url>https://jenkins.ci.sonatype.dev/job/ossindex/job/ossindex-service</url>
  </ciManagement>

  <distributionManagement>
    <site>
      <id>sonatype-ghpages</id>
      <url>scm:git:ssh://git@github.com/sonatype/ossindex-public.git</url>
    </site>
  </distributionManagement>

  <properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>

    <dionysus.version>1.0.3</dionysus.version>

    <build.notes>t:local, u:${user.name}</build.notes>
  </properties>

  <modules>
    <module>bom</module>
    <module>api</module>
    <module>client</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>org.owasp.maven.enforcer</groupId>
              <artifactId>class-file-format-rule</artifactId>
              <version>1.0.0</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
            <source>1.8</source>
            <additionalOptions>
              <!-- Turn off strict javadoc checks in Java-8 -->
              <option>-Xdoclint:none</option>
            </additionalOptions>
            <links>
              <link>https://sonatype.github.io/package-url-java/maven/apidocs</link>
              <link>https://sonatype.github.io/dropwizard-support/maven/apidocs</link>
              <link>https://jax-rs.github.io/apidocs/2.0.1</link>
            </links>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>

        <!--
        Use headers.sh script.
        -->
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <configuration>
            <includes combine.children="append">
              <include>**/*.ftl</include>
            </includes>
            <excludes combine.children="append">
              <exclude>src/site/hugo/**</exclude>
              <exclude>*.sh</exclude>
              <exclude>*.cmd</exclude>
              <exclude>private/**</exclude>
              <exclude>references/**</exclude>
            </excludes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.sonatype.goodies.dionysus</groupId>
          <artifactId>dionysus-maven-plugin</artifactId>
          <version>${dionysus.version}</version>
          <configuration>
            <theme>
              <groupId>org.sonatype.goodies.dionysus</groupId>
              <artifactId>dionysus-hugo-theme</artifactId>
              <version>${dionysus.version}</version>
            </theme>
            <mavenOptions>
              <option>-P!include-private</option>
            </mavenOptions>
            <mavenGoals>
              <goal>javadoc:aggregate</goal>
              <goal>jxr:aggregate</goal>
            </mavenGoals>
            <generators>
              <mavenLicenses/>
              <mavenModules/>
              <mavenPom/>
              <mavenPlugin/>
            </generators>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.3,)</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[1.7,)</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <buildNumberPropertyName>build.tag</buildNumberPropertyName>
              <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>3.4.0-01</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.4.17-01</version>
          </dependency>
        </dependencies>
        <configuration>
          <compilerId>groovy-eclipse-compiler</compilerId>
          <!--
          <compilerArguments>
            <indy/>
          </compilerArguments>
          -->
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.eclipse.sisu</groupId>
        <artifactId>sisu-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>main-index</goal>
              <goal>test-index</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.sonatype.clm</groupId>
        <artifactId>clm-maven-plugin</artifactId>
        <version>2.8.1-01</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>index</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>include-private</id>
      <activation>
        <file>
          <exists>private/pom.xml</exists>
        </file>
      </activation>
      <modules>
        <module>private</module>
      </modules>
    </profile>

    <profile>
      <id>it</id>
      <activation>
        <property>
          <name>it</name>
          <value>true</value>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>dionysus</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-enforcer-plugin</artifactId>
              <configuration>
                <!-- site generation causes problems with project dependency resolution? -->
                <skip>true</skip>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

</project>
