<?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>io.github.mightguy</groupId>
  <artifactId>symspell</artifactId>
  <version>6.6.154</version>
  <packaging>pom</packaging>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.0</version>
  </parent>

  <name>${project.artifactId}</name>
  <description>Customized version of Symspell, Java port of the version 6.6</description>
  <url>https://github.com/MighTguY/customized-symspell</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>

    <skip.unit.tests>false</skip.unit.tests>

    <lombok.version>1.18.16</lombok.version>

    <checkstyle.version>8.29</checkstyle.version>
    <checkstyle.location>google_checks.xml</checkstyle.location>
    <checkstyle.exclusions>checkstyle-suppressions.xml</checkstyle.exclusions>
    <failOnStyleViolation>true</failOnStyleViolation>

    <jacoco.version>0.8.6</jacoco.version>
    <jacoco.unittests.destFile>${project.build.directory}/coverage-reports/jacoco.exec
    </jacoco.unittests.destFile>
    <jacoco.unittests.reportPath>${project.build.directory}/coverage-reports/unit-tests
    </jacoco.unittests.reportPath>
    <jacoco.unittests.folder.reportPath>/coverage-reports/unit-tests</jacoco.unittests.folder.reportPath>
    <coverage.threshold>0.0</coverage.threshold> <!-- //TODO: update to 75%-->
    <sonar.jacoco.reportPath>${jacoco.unittests.destFile}</sonar.jacoco.reportPath>
    <sonar.jacoco.reportPaths>${jacoco.unittests.destFile}</sonar.jacoco.reportPaths>
    <sonar.projectKey>${project.artifactId}</sonar.projectKey>
    <sonar.projectName>${project.artifactId}</sonar.projectName>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.sources>src/main/java</sonar.sources>
    <sonar.binaries>target/classes</sonar.binaries>
    <sonar.tests>src/test/java</sonar.tests>

    <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
    <maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
    <maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
    <build-helper.plugin.version>3.2.0</build-helper.plugin.version>
    <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>

    <apache.commons-collections4.version>4.4</apache.commons-collections4.version>
    <apache.commons-csv.version>1.8</apache.commons-csv.version>
    <apache.commons-lang3.version>3.11</apache.commons-lang3.version>
    <hamcrest.version>2.2</hamcrest.version>
    <jmh.version>1.19</jmh.version>
    <junit.version>4.12</junit.version>
    <murmur.version>1.0.0</murmur.version>
    <springfox-swagger.version>3.0.0</springfox-swagger.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${project.parent.groupId}</groupId>
        <artifactId>symspell-lib</artifactId>
        <version>${project.parent.version}</version>
      </dependency>

      <dependency>
        <groupId>com.sangupta</groupId>
        <artifactId>murmur</artifactId>
        <version>${murmur.version}</version>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>${apache.commons-collections4.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${apache.commons-lang3.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
      </dependency>
      <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-core</artifactId>
        <version>${jmh.version}</version>
      </dependency>
      <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-generator-annprocess</artifactId>
        <version>${jmh.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>${apache.commons-csv.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eluder.coveralls</groupId>
          <artifactId>coveralls-maven-plugin</artifactId>
          <version>4.3.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>checkstyle</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <configLocation>${checkstyle.location}</configLocation>
              <consoleOutput>true</consoleOutput>
              <failOnViolation>${failOnStyleViolation}</failOnViolation>
              <logViolationsToConsole>true</logViolationsToConsole>
              <violationSeverity>warning</violationSeverity>
              <includeTestSourceDirectory>false</includeTestSourceDirectory>
              <suppressionsLocation>${checkstyle.exclusions}</suppressionsLocation>
              <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <phase>initialize</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <destFile>${jacoco.unittests.destFile}</destFile>
              <!-- Sets the name of the property containing the settings for JaCoCo
               runtime agent. -->
              <propertyName>surefireArgLine</propertyName>
            </configuration>
          </execution>
          <execution> <!-- for coverage threshold check -->
            <id>check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <dataFile>${jacoco.unittests.destFile}</dataFile>
              <haltOnFailure>true</haltOnFailure>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                  <excludes>
                    <exclude>*Test.java</exclude>
                  </excludes>
                  <limits>
                    <limit implementation="org.jacoco.report.check.Limit">
                      <counter>INSTRUCTION</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${coverage.threshold}</minimum>
                    </limit>
                  </limits>
                </rule>z
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <dataFile>${jacoco.unittests.destFile}</dataFile>
              <!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>${jacoco.unittests.reportPath}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <doclint>none</doclint>
              <failOnError>false</failOnError>
              <quiet>true</quiet>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>${skip.unit.tests}</skipTests>
          <argLine>${surefireArgLine} -Dtest.solr.allowed.securerandom=NativePRNG
          </argLine> <!-- The reference to argLine is critical, because this causes surefire to write to the correct Jacoco output file. -->
          <includes>
            <include>**/*Test*</include>
          </includes>
          <failIfNoTests>false
          </failIfNoTests> <!-- //TODO: update to 'true' once the tests are added -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>${sonar-maven-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.eluder.coveralls</groupId>
        <artifactId>coveralls-maven-plugin</artifactId>
        <version>4.3.0</version>
        <configuration>
          <jacocoReports>
            <jacocoReport>symspell-lib/target${jacoco.unittests.folder.reportPath}/jacoco.xml</jacocoReport>
            <jacocoReport>symspell-solr/target${jacoco.unittests.folder.reportPath}/jacoco.xml</jacocoReport>
          </jacocoReports>
          <repoToken>QdxFNoS4I2m7FTQzjNcluRjyDy8fbUdVN</repoToken>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jacoco-unit-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.plugin.version}</version>
            <configuration>
              <argLine>${surefireArgLine}</argLine>
              <skipTests>${skip.unit.tests}</skipTests>
              <includes>
                <include>**/*Test*</include>
              </includes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>${build-helper.plugin.version}</version>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>${maven-release-plugin.version}</version>
            <configuration>
              <localCheckout>true</localCheckout>
              <autoVersionSubmodules>true</autoVersionSubmodules>
            </configuration>
          </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-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <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.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus-staging-maven-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <doclint>none</doclint>
                  <failOnError>false</failOnError>
                  <quiet>true</quiet>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>


  <scm>
    <connection>scm:git:git://github.com/mightguy/customized-symspell.git</connection>
    <developerConnection>scm:git:ssh://github.com/mightguy/customized-symspell.git
    </developerConnection>
    <url>https://github.com/mightguy/customized-symspell/tree/master</url>
  </scm>


  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Lucky Sharma</name>
      <email>iamluckysharma.0910@gmail.com</email>
      <organization>io.github.mightguy</organization>
      <organizationUrl>https://github.com/mightguy/customized-symspell</organizationUrl>
    </developer>
  </developers>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <modules>
    <module>symspell-lib</module>
    <module>symspell-console</module>
    <module>symspell-solr</module>
    <module>symspell-service</module>
  </modules>

</project>
