<!--
  Copyright 2020 The OpenTracing Authors

  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>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>common</artifactId>
  <version>0.1.4</version>
  <name>Java Common</name>
  <description>Common utilities for OpenTracing Instrumentation Plugins</description>
  <url>https://github.com/opentracing-contrib/java-common</url>
  <scm>
    <url>https://github.com/opentracing-contrib/java-common</url>
    <connection>scm:git:https://github.com/opentracing-contrib/java-common.git</connection>
    <developerConnection>scm:git:https://github.com/opentracing-contrib/java-common.git</developerConnection>
    <tag>HEAD</tag>
  </scm>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>safris</id>
      <name>Seva Safris</name>
      <email>seva@safris.org</email>
    </developer>
  </developers>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>
  <profiles>
    <profile>
      <id>tools.jar</id>
      <activation>
        <jdk>(,1.8]</jdk>
      </activation>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6.0</version>
            <scope>system</scope>
            <systemPath>${java.home}/../lib/tools.jar</systemPath>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>
    <profile>
      <id>maven.test.skip</id>
      <activation>
        <property>
          <name>maven.test.skip</name>
        </property>
      </activation>
      <properties>
        <skipTests>true</skipTests>
        <skipITests>true</skipITests>
      </properties>
    </profile>
    <profile>
      <id>skipTests</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <properties>
        <skipITests>true</skipITests>
      </properties>
    </profile>
    <profile>
      <id>!skipITests</id>
      <activation>
        <property>
          <name>!skipITests</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>integration-test</id>
                <configuration>
                  <skipITs>${maven.test.skip}</skipITs>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>javadoc</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>report</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>install</phase>
                <goals>
                  <goal>report</goal>
                </goals>
                <configuration>
                  <skip>${skipTests}</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.eluder.coveralls</groupId>
            <artifactId>coveralls-maven-plugin</artifactId>
            <version>4.3.0</version>
            <configuration>
              <timestampFormat>EpochMillis</timestampFormat>
            </configuration>
            <executions>
              <execution>
                <phase>deploy</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>pom</id>
      <activation>
        <file>
          <missing>src</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>report</goal>
                </goals>
                <configuration>
                  <skip>true</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>deploy</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <excludes>
                <exclude>**/*.class</exclude>
                <exclude>**/*.jar</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <!-- Necessary for GPG v2.2+ -->
                <!--configuration>
                  <gpgArguments>
                    <arg>- -pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration-->
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
            <configuration>
              <deployAtEnd>true</deployAtEnd>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.8</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>sonatype-staging</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.1.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
          <systemPropertyVariables>
            <java.awt.headless>true</java.awt.headless>
          </systemPropertyVariables>
          <runOrder>alphabetical</runOrder>
          <includes>
            <include>**/*Test</include>
            <include>**/*TestCase</include>
          </includes>
          <excludes>
            <exclude></exclude> <!-- This is necessary for inner classes to be run -->
            <exclude>**/*ITest</exclude>
            <exclude>**/*IntegrationTest</exclude>
            <exclude>**/*IntegrationTestCase</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.22.1</version>
        <configuration>
          <systemPropertyVariables>
            <java.awt.headless>true</java.awt.headless>
          </systemPropertyVariables>
          <includes>
            <include>**/*ITest</include>
            <include>**/*IntegrationTest</include>
            <include>**/*IntegrationTestCase</include>
          </includes>
          <excludes>
            <exclude></exclude> <!-- This is necessary for inner classes to be run -->
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.2</version>
        <configuration>
          <includes>
            <include>io/opentracing/contrib/**</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-snapshot</id>
      <name>Sonatype Snapshot Repository</name>
      <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-staging</id>
      <name>Sonatype Staging Repository</name>
      <url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
  </distributionManagement>
</project>