<?xml version="1.0" encoding="UTF-8"?>
<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>com.introproventures</groupId>
  <artifactId>graphql-jpa-query</artifactId>
  <version>1.2.7</version>
  <packaging>pom</packaging>
  <name>GraphQL JPA Query</name>

  <description>
    GraphQL JPA Query library auto-generates GraphQL Schema using JPA's EntityManager
    and implements GraphQL Relay protocol to execute JPA queries with flexible type safe
    criteria expressions and user-friendly SQL query syntax semantics.
  </description>

  <properties>
    <java.version>17</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>

    <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
    <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
    <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
    <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    <prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <skipPrettier>false</skipPrettier>
    <skipStaging>false</skipStaging>
    <generateBackupPoms>false</generateBackupPoms> 
  </properties>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus snapshot repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Sonatype Nexus release repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
  </distributionManagement>

  <scm>
    <connection>scm:git:https://github.com/introproventures/graphql-jpa-query.git</connection>
    <developerConnection>scm:git:git@github.com:introproventures/graphql-jpa-query.git</developerConnection>
    <url>https://github.com/introproventures/graphql-jpa-query</url>
    <tag>1.2.7</tag>
  </scm>

  <inceptionYear>2017</inceptionYear>
  <url>https://github.com/introproventures/graphql-jpa-query</url>

  <licenses>
    <license>
      <name>Apache 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>

  <issueManagement>
    <url>https://github.com/introproventures/graphql-jpa-query/issues</url>
    <system>GitHub Issues</system>
  </issueManagement>

  <!-- Required: developer information: -->
  <developers>
    <developer>
      <id>igdianov</id>
      <name>Igor Dianov</name>
      <email>igor.dianov@introproventures.com</email>
      <organization>IntroPro Ventures Inc.</organization>
      <organizationUrl>https://github.com/introproventures</organizationUrl>
      <url>https://github.com/igdianov</url>
    </developer>
  </developers>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>info.plichta.maven.plugins</groupId>
          <artifactId>git-changelog-maven-plugin</artifactId>
          <version>0.6.0</version>
          <configuration>
            <gitHubUrl>${project.scm.url}</gitHubUrl>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven-deploy-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.6.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <!-- Include the README, NOTICE and LICENSE files: -->
    <resources>
      <resource>
        <directory>${project.basedir}</directory>
        <includes>
          <include>README*</include>
          <include>NOTICE*</include>
          <include>LICENSE*</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>

      <!-- Optional: JVM version compliance and encoding: -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release>${java.version}</release>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <compilerArgs>
            <arg>-parameters</arg>
          </compilerArgs>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptorSourceDirectory>assembly</descriptorSourceDirectory>
          <archiverConfig>
            <duplicateBehavior>skip</duplicateBehavior>
          </archiverConfig>
        </configuration>
      </plugin>

      <!-- Release configuration: -->
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <tagNameFormat>@{version}</tagNameFormat>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <releaseProfiles>releases</releaseProfiles>
          <arguments>-DskipTests -DskipDocker</arguments>
          <mavenExecutorId>forked-path</mavenExecutorId>
          <preparationGoals>clean git-changelog:git-changelog scm:checkin -DpushChanges=false -Dincludes=CHANGELOG.md
            -Dmessage="[maven-release-plugin] Update CHANGELOG.md" verify
          </preparationGoals>
          <completionGoals>git-changelog:git-changelog scm:checkin -DpushChanges=false -Dincludes=CHANGELOG.md
            -Dmessage="[maven-release-plugin] Update CHANGELOG.md"
          </completionGoals>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <includes>
            <include>**/*Test.java</include>
            <include>**/*Tests.java</include>
            <include>**/*Test_*.java</include>
            <include>**/*Tests_*.java</include>
          </includes>
          <systemPropertyVariables>
            <user.timezone>UTC</user.timezone>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <!-- Required: javadoc JAR -->
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.6.3</version>
        <configuration>
          <source>${java.version}</source>
          <doclint>none</doclint>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadoc</id>
            <phase>verify</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Ensure the manifest contains artifact version information: -->
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.4.1</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
      <!-- Required: source JAR -->
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>package</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- just to make sure deployed artifacts are always built
            (and tested) using JDK 8 -->
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.4.1</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <phase>deploy</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${java.version}</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <executions>
          <!-- Unit tests configuration -->
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <!-- Integration tests configuration -->
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent-integration</goal>
            </goals>
          </execution>
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report-integration</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.hubspot.maven.plugins</groupId>
        <artifactId>prettier-maven-plugin</artifactId>
        <version>${prettier-maven-plugin.version}</version>
        <configuration>
          <skip>${skipPrettier}</skip>
          <prettierJavaVersion>2.0.0</prettierJavaVersion>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <modules>
        <module>annotations</module>
        <module>scalars</module>
        <module>schema</module>
        <module>boot-starter</module>
        <module>dependencies</module>
        <module>build</module>
        <module>autoconfigure</module>
        <module>web</module>
        <module>introspection</module>
        <module>tests</module>
        <module>examples</module>
      </modules>
    </profile>
    <profile>
      <id>releases</id>
      <modules>
        <module>annotations</module>
        <module>scalars</module>
        <module>schema</module>
        <module>boot-starter</module>
        <module>dependencies</module>
        <module>build</module>
        <module>autoconfigure</module>
        <module>web</module>
        <module>introspection</module>
        <module>tests</module>
      </modules>
      <build>
        <plugins>
          <!-- Deployment -->
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <executions>
              <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
            <extensions>true</extensions>
            <configuration>
              <serverId>sonatype-nexus-staging</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
              <skipStaging>${skipStaging}</skipStaging>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- GPG Signature on release -->
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <repositories>
    <!-- Maven2 is just to speed up downloading repositories -->
    <repository>
      <id>maven2</id>
      <name>maven2</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
    <repository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

</project>
