<!--
  Copyright (c) 2019 OpenJAX

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  You should have received a copy of The MIT License (MIT) along with this
  program. If not, see <http://opensource.org/licenses/MIT/>.
-->
<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>org.openjax</groupId>
  <artifactId>root</artifactId>
  <version>1.0.5</version>
  <packaging>pom</packaging>
  <url>https://github.com/openjax/root</url>
  <name>Root POM</name>
  <description>
    Root POM offering sonatype deployment, integration and regression test phases, and reporting.
  </description>
  <organization>
    <name>OpenJAX</name>
    <url>https://www.openjax.org/</url>
  </organization>
  <scm>
    <url>https://github.com/openjax/root</url>
    <connection>scm:git:https://github.com/openjax/root.git</connection>
    <developerConnection>scm:git:https://github.com/openjax/root.git</developerConnection>
    <tag>HEAD</tag>
  </scm>
  <licenses>
    <license>
      <name>The MIT License (MIT)</name>
      <url>https://opensource.org/licenses/MIT/</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.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <jmh.version>1.22</jmh.version>
  </properties>
  <profiles>
    <profile>
      <id>itestCompile</id>
      <activation>
        <property>
          <name>!ZqMEGUbGeRJsDFjS86gYPg2Y</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.0</version>
              <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
              </configuration>
              <executions>
                <execution>
                  <id>default-testCompile</id>
                  <phase>test-compile</phase>
                  <goals>
                    <goal>testCompile</goal>
                  </goals>
                  <configuration>
                    <annotationProcessorPaths>
                      <path>
                        <groupId>org.openjdk.jmh</groupId>
                        <artifactId>jmh-generator-annprocess</artifactId>
                        <version>${jmh.version}</version>
                      </path>
                    </annotationProcessorPaths>
                    <testExcludes>
                      <exclude>**/*ITest.java</exclude>
                      <exclude>**/*IntegrationTest.java</exclude>
                      <exclude>**/*IntegrationTestCase.java</exclude>
                      <exclude>**/*RTest.java</exclude>
                      <exclude>**/*RegressionTest.java</exclude>
                      <exclude>**/*RegressionTestCase.java</exclude>
                    </testExcludes>
                  </configuration>
                </execution>
                <execution>
                  <id>default-itestCompile</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>testCompile</goal>
                  </goals>
                  <configuration>
                    <annotationProcessorPaths>
                      <path>
                        <groupId>org.openjdk.jmh</groupId>
                        <artifactId>jmh-generator-annprocess</artifactId>
                        <version>${jmh.version}</version>
                      </path>
                    </annotationProcessorPaths>
                    <testIncludes>
                      <include>**/*ITest.java</include>
                      <include>**/*IntegrationTest.java</include>
                      <include>**/*IntegrationTestCase.java</include>
                      <include>**/*RTest.java</include>
                      <include>**/*RegressionTest.java</include>
                      <include>**/*RegressionTestCase.java</include>
                    </testIncludes>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>tools.jar</id>
      <activation>
        <jdk>(,9)</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>jmh</id>
      <activation>
        <jdk>(,12)</jdk>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.openjdk.jmh</groupId>
          <artifactId>jmh-core</artifactId>
          <version>${jmh.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.openjdk.jmh</groupId>
          <artifactId>jmh-generator-annprocess</artifactId>
          <version>${jmh.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>maven.test.skip</id>
      <activation>
        <property>
          <name>maven.test.skip</name>
        </property>
      </activation>
      <properties>
        <skipTests>true</skipTests>
        <skipITests>true</skipITests>
        <skipRTests>true</skipRTests>
      </properties>
    </profile>
    <profile>
      <id>skipTests</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <properties>
        <skipITests>true</skipITests>
        <skipRTests>true</skipRTests>
      </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>!skipRTests</id>
      <activation>
        <property>
          <name>!skipRTests</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <executions>
                <execution>
                  <id>regression-test</id>
                  <configuration>
                    <skipITs>${skipITests}</skipITs>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>javadoc</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.safris.maven</groupId>
            <artifactId>javadocio-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <detectGeneratedSourcePaths>true</detectGeneratedSourcePaths>
                  <detectOfflineLinks>false</detectOfflineLinks>
                  <quiet>true</quiet>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>invoke-maven-plugin-test</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
        <file>
          <exists>src/main/resources/META-INF/plexus/components.xml</exists>
        </file>
      </activation>
      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <skipInvocation>${skipTests}</skipInvocation>
                  <pom>pom.xml</pom>
                  <noLog>true</noLog>
                  <streamLogs>true</streamLogs>
                  <showErrors>true</showErrors>
                  <properties>
                    <argLine>${argLine}</argLine>
                    <skipTests>${skipTests}</skipTests>
                    <skipITests>${skipITests}</skipITests>
                    <skipRTests>${skipRTests}</skipRTests>
                    <repoToken>${repoToken}</repoToken>
                  </properties>
                  <mavenOpts>${argLine}</mavenOpts>
                  <goals>
                    <goal>install</goal>
                  </goals>
                  <profiles>
                    <profile>!report</profile>
                    <profile>!javadoc</profile>
                    <profile>!invoke-maven-plugin-test</profile>
                    <profile>maven-plugin-test</profile>
                  </profiles>
                </configuration>
              </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.safris.maven</groupId>
            <artifactId>coverallsio-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <detectGeneratedSourcePaths>true</detectGeneratedSourcePaths>
              <timestampFormat>EpochMillis</timestampFormat>
              <skip>${skipTests}</skip> <!-- there is actually no "skip" parameter! -->
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>non-maven-plugin</id>
      <activation>
        <file>
          <missing>src/main/resources/META-INF/plexus/components.xml</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>default-jar</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <archive>
                    <manifestEntries>
                      <Automatic-Module-Name>${project.groupId}.${project.artifactId}</Automatic-Module-Name>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>maven-archetype</id>
      <activation>
        <file>
          <exists>src/main/resources/archetype-resources</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <inherited>false</inherited>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>pom</id>
      <activation>
        <file>
          <missing>src/main/java</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <skip>true</skip>
                </configuration>
              </execution>
              <execution>
                <id>report</id>
                <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-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>
              <retryFailedDeploymentCount>3</retryFailedDeploymentCount>
            </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-failsafe-plugin</artifactId>
        <configuration>
          <skipITs>true</skipITs>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
              <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>
          </execution>
          <execution>
            <id>regression-test</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <includes>
                <include>**/*RTest</include>
                <include>**/*RegressionTest</include>
                <include>**/*RegressionTestCase</include>
              </includes>
              <excludes>
                <exclude></exclude> <!-- This is necessary for inner classes to be run -->
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>process-test-resources</id>
            <!-- Move testResources to verify phase, because integration-test may generate test resources -->
            <phase>verify</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <skipIfEmpty>true</skipIfEmpty>
            </configuration>
          </execution>
          <execution>
            <id>default-test-jar</id>
            <!-- Move test-jar to verify phase, because integration-test may generate test resources -->
            <phase>verify</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <skipIfEmpty>true</skipIfEmpty>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.safris.maven</groupId>
          <artifactId>javadocio-maven-plugin</artifactId>
          <version>0.1.2</version>
          <configuration>
            <sourceFileExcludes>
              <sourceFileExclude>**/*_*_*/*.java</sourceFileExclude> <!-- Exclude JAX-B sources -->
              <sourceFileExclude>**/xAA.java</sourceFileExclude> <!-- Exclude JAX-SB sources -->
            </sourceFileExcludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>2.0.0</version> <!-- v3 clones the src into "its" dir, which breaks everything -->
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
            <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>
              <exclude>**/*RTest</exclude>
              <exclude>**/*RegressionTest</exclude>
              <exclude>**/*RegressionTestCase</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.2</version>
        </plugin>
        <plugin>
          <groupId>org.safris.maven</groupId>
          <artifactId>coverallsio-maven-plugin</artifactId>
          <version>4.3.0-1</version>
        </plugin>
        <plugin>
          <groupId>org.openjax.jaxb</groupId>
          <artifactId>jaxb-maven-plugin</artifactId>
          <version>0.8.5</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>xjc</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.openjax.xml</groupId>
          <artifactId>xml-maven-plugin</artifactId>
          <version>0.9.4</version>
          <executions>
            <execution>
              <id>compile</id>
              <goals>
                <goal>validate</goal>
              </goals>
              <phase>generate-sources</phase>
              <configuration>
                <failOnNoOp>false</failOnNoOp>
                <includes>
                  <include>src/main/**/*.ddlx</include>
                  <include>src/main/**/*.sqlx</include>
                  <include>src/main/**/*.jsdx</include>
                  <include>src/main/**/*.xml</include>
                  <include>src/main/**/*.xsd</include>
                  <!--include>src/main/**/*.xsl</include-->
                </includes>
              </configuration>
            </execution>
            <execution>
              <id>test-compile</id>
              <goals>
                <goal>validate</goal>
              </goals>
              <phase>generate-test-sources</phase>
              <configuration>
                <failOnNoOp>false</failOnNoOp>
                <includes>
                  <include>src/test/**/*.ddlx</include>
                  <include>src/test/**/*.sqlx</include>
                  <include>src/test/**/*.jsdx</include>
                  <include>src/test/**/*.xml</include>
                  <include>src/test/**/*.xsd</include>
                  <!--include>src/test/**/*.xsl</include-->
                </includes>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <dependencies>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <artifactId>junit</artifactId>
      <groupId>junit</groupId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.3</version>
      </dependency>
      <dependency>
        <artifactId>junit</artifactId>
        <groupId>junit</groupId>
        <version>4.12</version>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>3.1.0</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <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>