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

    Copyright (C) 2015 Red Hat, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

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

-->
<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>
    <groupId>io.fabric8</groupId>
    <artifactId>service-catalog</artifactId>
    <version>4.8.0</version>
  </parent>

  <artifactId>servicecatalog-model-generator</artifactId>
  <packaging>pom</packaging>
  <name>Fabric8 :: Service Catalog Model Parent</name>

  <properties>
    <itest>true</itest>

    <skipTests>false</skipTests>
    <testExclusionPattern>**/*KubernetesTest.java</testExclusionPattern>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <osgi.import />
    <osgi.export />
    <osgi.private />
    <osgi.dynamic.import />
    <osgi.bundles />
    <osgi.activator />
    <osgi.export.service />
    <osgi.include.resources>{maven-resources}</osgi.include.resources>
  </properties>

  <modules>
    <module>servicecatalog-model-annotator</module>
    <module>servicecatalog-model</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <!-- Internal Dependencies -->
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>servicecatalog-model</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.sundr</groupId>
        <artifactId>dsl-annotations</artifactId>
        <version>${sundrio.version}</version>
        <scope>compile</scope>
        <optional>true</optional>
      </dependency>

      <!-- Testing and Mocking -->
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>mockwebserver</artifactId>
        <version>${mockwebserver.version}</version>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <!-- see: https://discuss.circleci.com/t/the-forked-vm-terminated-without-properly-saying-goodbye-while-running-tests/26246/9 -->
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <index>true</index>
            <manifest>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-URL>${project.url}</Implementation-URL>
              <Java-Version>${java.version}</Java-Version>
              <Java-Vendor>${java.vendor}</Java-Vendor>
              <Os-Name>${os.name}</Os-Name>
              <Os-Arch>${os.arch}</Os-Arch>
              <Os-Version>${os.version}</Os-Version>
              <Scm-Url>${project.scm.url}</Scm-Url>
              <Scm-Connection>${project.scm.connection}</Scm-Connection>
              <Scm-Revision>${buildNumber}</Scm-Revision>
              <Build-Timestamp>${build.datetime}</Build-Timestamp>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <!-- Set properties containing the scm revision and build timestamp -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>${buildnumber.plugin.version}</version>
        <executions>
          <execution>
            <id>get-build-timestamp</id>
            <phase>initialize</phase>
            <goals>
              <goal>create-timestamp</goal>
            </goals>
            <configuration>
              <!-- Example date: Wed, 4 Jul 2001 12:08:56 -0700 -->
              <timestampFormat>EEE, d MMM yyyy HH:mm:ss Z</timestampFormat>
              <timestampPropertyName>build.datetime</timestampPropertyName>
            </configuration>
          </execution>
          <execution>
            <id>get-scm-revision</id>
            <phase>initialize</phase>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <doCheck>false</doCheck>
              <doUpdate>false</doUpdate>
              <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
              <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <nonFilteredFileExtensions>
            <nonFilteredFileExtension>zip</nonFilteredFileExtension>
            <nonFilteredFileExtension>gz</nonFilteredFileExtension>
            <nonFilteredFileExtension>jar</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <configuration>
          <passphrase>4uds0n</passphrase>
          <useAgent>true</useAgent>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>2.11</version>
        <configuration>
          <aggregate>true</aggregate>
          <header>header.txt</header>
          <properties>
            <owner>Red Hat, Inc.</owner>
          </properties>
          <excludes>
            <exclude>.editorconfig</exclude>
            <exclude>license.txt</exclude>
            <exclude>**/test-kubeconfig</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven.bundle.plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-Name>${project.name}</Bundle-Name>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Export-Package>${osgi.export}</Export-Package>
            <Import-Package>${osgi.import}</Import-Package>
            <DynamicImport-Package>${osgi.dynamic.import}</DynamicImport-Package>
            <Private-Package>${osgi.private}</Private-Package>
            <Require-Bundle>${osgi.bundles}</Require-Bundle>
            <Bundle-Activator>${osgi.activator}</Bundle-Activator>
            <Export-Service>${osgi.export.service}</Export-Service>
            <Include-Resource>${osgi.include.resources}</Include-Resource>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.sundr</groupId>
        <artifactId>sundr-maven-plugin</artifactId>
        <version>${sundrio.version}</version>
        <configuration>
          <boms>
            <bom>
              <artifactId>servicecatalog-java-api-bom</artifactId>
              <name>Snowdrop :: Service Catalog ::Bom</name>
              <properties>
                <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
              </properties>
            </bom>
            <bom>
              <artifactId>servicecatalog-java-api-bom-with-deps</artifactId>
              <name>Snowdrop :: Service Catalog ::Bom with Dependencies</name>
              <dependencies>
                <includes>
                  <include>com.squareup*:*</include>
                  <include>com.fasterxml.jackson*:*</include>
                </includes>
              </dependencies>
              <properties>
                <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
              </properties>
            </bom>
          </boms>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate-bom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${maven.enforcer.plugin.version}</version>
            <executions>
              <execution>
                <id>enforce-no-snapshots</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseDeps>
                      <message>No Snapshots Allowed!</message>
                    </requireReleaseDeps>
                  </rules>
                  <fail>false</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <configuration>
              <includeDependencySources>${javadoc.include.deps}</includeDependencySources>
              <dependencySourceIncludes>
                <dependencySourceInclude>${javadoc.source.includes}</dependencySourceInclude>
              </dependencySourceIncludes>
              <excludePackageNames>${javadoc.package.excludes}</excludePackageNames>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalparam>${javadoc.opts}</additionalparam>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
  </profiles>

</project>
