<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <prerequisites>
    <maven>3.2.5</maven>
  </prerequisites>

  <groupId>org.carrot2</groupId>
  <artifactId>morfologik-parent</artifactId>
  <version>2.1.3</version>
  <packaging>pom</packaging>

  <name>Morfologik (parent POM)</name>
  <description>Morfologik is a collection of tools for building finite state automata and stemming/ inflection dictionaries built on top of these. </description>
  <url>http://morfologik.blogspot.com/</url>

  <licenses>
    <license>
      <name>BSD</name>
      <url>http://www.opensource.org/licenses/bsd-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <mailingLists>
    <mailingList>
      <name>Announcements, bug reports, developers mailing list</name>
      <post>morfologik-devel@lists.sourceforge.net</post>
    </mailingList>
  </mailingLists>

  <scm>
    <url>git@github.com:morfologik/morfologik-stemming.git</url>
    <connection>scm:git:git@github.com:morfologik/morfologik-stemming.git</connection>
    <developerConnection>scm:git:git@github.com:morfologik/morfologik-stemming.git</developerConnection>
  </scm>

  <developers>
    <developer>
      <id>dawid.weiss</id>
      <name>Dawid Weiss</name>
      <email>dawid.weiss@carrotsearch.com</email>
    </developer>

    <developer>
      <id>marcin.milkowski</id>
      <name>Marcin Miłkowski</name>
    </developer>
  </developers>

  <properties>
    <version.assertj>2.2.0</version.assertj>
    <version.hppc>0.7.1</version.hppc>
    <version.junit>4.12</version.junit>
    <version.randomizedtesting>2.1.16</version.randomizedtesting>

    <version.maven-enforcer-plugin>1.4.1</version.maven-enforcer-plugin>
    <version.maven-clean-plugin>2.6.1</version.maven-clean-plugin>
  </properties>

  <modules>
    <module>morfologik-fsa</module>
    <module>morfologik-fsa-builders</module>
    <module>morfologik-stemming</module>
    <module>morfologik-polish</module>
    <module>morfologik-speller</module>
    <module>morfologik-tools</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.carrotsearch</groupId>
        <artifactId>hppc</artifactId>
        <version>${version.hppc}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${version.maven-clean-plugin}</version>
          <configuration>
            <failOnError>false</failOnError>
            <excludeDefaultDirectories>true</excludeDefaultDirectories>
            <filesets>
              <fileset>
                <directory>${project.build.directory}</directory>
                <excludes>
                  <exclude>eclipse/**</exclude>
                  <exclude>idea/**</exclude>
                </excludes>
              </fileset>
            </filesets>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.4</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.3</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.8</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.6</version>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.plexus</groupId>
              <artifactId>plexus-archiver</artifactId>
              <version>3.0.3</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>

        <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-dependency-plugin</artifactId>
          <version>2.10</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.3</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </plugin>

        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>3.0.0</version>
          <extensions>true</extensions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.18.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${version.maven-enforcer-plugin}</version>
        <configuration>
          <rules>
            <DependencyConvergence/>
          </rules>
        </configuration>
        <executions>
          <execution>
            <id>enforce-dependency-convergence</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>profile.require-mavenversion</id>
      <activation>
        <file><exists>etc/profiles/require-mavenversion.enabled</exists></file>
      </activation>

      <properties>
        <version.maven>3.2.5</version.maven>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${version.maven-enforcer-plugin}</version>
            <executions>
              <execution>
                <id>enforce-environment</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <inherited>true</inherited>
                <configuration>
                  <rules combine.children="append">
                    <requireMavenVersion>
                      <version>[${version.maven},)</version>
                      <message>At least Maven ${version.maven}+ required.</message>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>profile.require-java17</id>
      <activation>
        <file><exists>etc/profiles/require-java17.enabled</exists></file>
      </activation>

      <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${version.maven-enforcer-plugin}</version>
            <executions>
              <execution>
                <id>enforce-environment</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <inherited>true</inherited>
                <configuration>
                  <rules combine.children="append">
                    <requireJavaVersion>
                      <version>1.7.0</version>
                    </requireJavaVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>profile.forbidden-apis</id>

      <activation>
        <file>
          <exists>etc/profiles/forbidden-apis.enabled</exists>
        </file>
      </activation>

      <properties>
          <version.forbiddenapis>1.8</version.forbiddenapis>
          <forbiddenapis.signaturefile>src/forbidden-apis/signatures.txt</forbiddenapis.signaturefile>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>de.thetaphi</groupId>
            <artifactId>forbiddenapis</artifactId>
            <version>${version.forbiddenapis}</version>

            <executions>
              <execution>
                <id>forbidden-apis</id>
                <configuration>
                  <targetVersion>${maven.compiler.source}</targetVersion>
                  <internalRuntimeForbidden>true</internalRuntimeForbidden>
                  <failOnUnsupportedJava>false</failOnUnsupportedJava>
                  <failOnUnresolvableSignatures>false</failOnUnresolvableSignatures>
                  <excludes>
                  </excludes>
                  <bundledSignatures>
                    <bundledSignature>jdk-unsafe</bundledSignature>
                    <bundledSignature>jdk-deprecated</bundledSignature>
                    <bundledSignature>jdk-system-out</bundledSignature>
                  </bundledSignatures>
                  <signaturesFiles>
                    <signaturesFile>${forbiddenapis.signaturefile}</signaturesFile>
                  </signaturesFiles>                   
                </configuration>
                <phase>process-classes</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>profile.randomizedtesting</id>

      <activation>
        <file>
            <exists>etc/profiles/randomizedtesting.enabled</exists>
        </file>
      </activation>

      <dependencies>
        <dependency>
          <groupId>com.carrotsearch.randomizedtesting</groupId>
          <artifactId>randomizedtesting-runner</artifactId>
          <version>${version.randomizedtesting}</version>
          <scope>test</scope>
          <exclusions>
            <exclusion><!-- prevents maven-enforcer DependencyConvergence error - bring in our own version below -->
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>${version.junit}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.assertj</groupId>
          <artifactId>assertj-core</artifactId>
          <version>${version.assertj}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>default-test</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.carrotsearch.randomizedtesting</groupId>
            <artifactId>junit4-maven-plugin</artifactId>
            <version>${version.randomizedtesting}</version>
  
            <!-- Defaults for all tests (ITs and Unit). -->
            <configuration>
              <parallelism>auto</parallelism>
              <heartbeat>30</heartbeat>
              <jvmOutputAction>pipe,ignore</jvmOutputAction>
              <leaveTemporary>true</leaveTemporary>
              <ifNoTests>warn</ifNoTests>

              <assertions>
                <enable />
              </assertions>

              <listeners>
                <report-text showThrowable="true" showStackTraces="true" showOutput="onerror" showStatusOk="true"
                  showStatusError="true" showStatusFailure="true" showStatusIgnored="true" showSuiteSummary="true" />

                <report-ant-xml mavenExtensions="true" dir="${project.build.directory}/surefire-reports" />
                <report-json file="${project.build.directory}/test-results.html" />
              </listeners>
            </configuration>

            <executions>
              <!-- Defaults for unit tests. -->
              <execution>
                <id>unit-tests</id>
                <phase>test</phase>
                <goals>
                  <goal>junit4</goal>
                </goals>
                <inherited>true</inherited>
                <configuration>
                  <includes>
                    <include>**/Test*.class</include>
                    <include>**/*Test.class</include>
                  </includes>
                  <excludes>
                    <exclude>**/*$*</exclude>
                    <exclude>**/TestBase.class</exclude>
                  </excludes>
                </configuration>
              </execution>
  
              <!-- Defaults for integration tests. -->
              <execution>
                <id>integration-tests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>junit4</goal>
                </goals>
                <inherited>true</inherited>
                <configuration>
                  <includes>
                    <include>**/IT*.class</include>
                    <include>**/*IT.class</include>
                  </includes>
                  <excludes>
                    <exclude>**/*$*</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>profile.ide.eclipse-m2e</id>
      
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      
      <build>
        <directory>target/eclipse</directory>

        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>de.thetaphi</groupId>
                        <artifactId>forbiddenapis</artifactId>
                        <versionRange>[1.0.0,)</versionRange>
                        <goals>
                          <goal>testCheck</goal>
                          <goal>check</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>quick</id>
      
      <properties>
        <skipTests>true</skipTests>
      </properties>
    </profile>

    <profile>
      <id>eclipse</id>
      <build>
        <defaultGoal>compile antrun:run</defaultGoal>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>1.8</version>
              <executions>
                <execution>
                  <id>default-cli</id>
                  <phase>none</phase>
                  <inherited>false</inherited>
                  <configuration>
                    <target>
                      <presetdef name="copy">
                        <copy overwrite="true" />
                      </presetdef>
                      <condition property="onwin">
                        <os family="windows" />
                      </condition>

                      <fileset id="id:settings" dir="etc/eclipse/settings" />
                      <copy todir="morfologik-fsa/.settings">           <fileset refid="id:settings" /></copy>
                      <copy todir="morfologik-fsa-builders/.settings">  <fileset refid="id:settings" /></copy>
                      <copy todir="morfologik-polish/.settings">        <fileset refid="id:settings" /></copy>
                      <copy todir="morfologik-speller/.settings">       <fileset refid="id:settings" /></copy>
                      <copy todir="morfologik-stemming/.settings">      <fileset refid="id:settings" /></copy>
                      <copy todir="morfologik-tools/.settings">         <fileset refid="id:settings" /></copy>

                      <!-- no custom configs.
                      <copy todir=".">
                        <fileset dir="etc/eclipse/configs" />
                        <filtermapper>
                          <replacestring from="_" to="." />
                        </filtermapper>
                        <filterchain unless:true="${onwin}" xmlns:unless="ant:unless">
                          <tokenfilter>
                            <filetokenizer />
                            <replacestring from=".bat" to="" />
                          </tokenfilter>
                        </filterchain>
                      </copy> -->
                    </target>
                  </configuration>
                  <goals>
                    <goal>run</goal>
                  </goals>
                </execution>
              </executions>
              <dependencies>
                <dependency>
                  <groupId>org.apache.ant</groupId>
                  <artifactId>ant</artifactId>
                  <version>1.9.4</version>
                </dependency>
              </dependencies>
            </plugin>

            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>de.thetaphi</groupId>
                        <artifactId>forbiddenapis</artifactId>
                        <versionRange>[0.0.0,)</versionRange>
                        <goals>
                          <goal>check</goal>
                          <goal>testCheck</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>com.carrotsearch</groupId>
                        <artifactId>hppc-template-processor</artifactId>
                        <versionRange>[0.0.0,)</versionRange>
                        <goals>
                          <goal>template-processor</goal>
                          <goal>add-source</goal>
                          <goal>add-test-source</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <execute>
                          <runOnIncremental>false</runOnIncremental>
                          <runOnConfiguration>true</runOnConfiguration>
                        </execute>
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-plugin-plugin</artifactId>
                        <versionRange>[3.4,)</versionRange>
                        <goals>
                          <goal>descriptor</goal>
                          <goal>helpmojo</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore></ignore>
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <versionRange>[0.0,)</versionRange>
                        <goals>
                          <goal>enforce</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore></ignore>
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    
    <profile>
      <id>sonatype-oss-release</id>

      <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Sonatype Nexus Releases</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>

      <repositories>
        <repository>
          <id>sonatype-nexus-snapshots</id>
          <name>Sonatype Nexus Snapshots</name>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*.gz</exclude>
                <exclude>**/*.zip</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <encoding>${project.build.sourceEncoding}</encoding>
              <windowtitle>${project.name} v${project.version} API Documentation</windowtitle>
              <doctitle>${project.name} v${project.version} API Documentation</doctitle>
              <charset>UTF-8</charset>
              <detectJavaApiLink>false</detectJavaApiLink>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <configuration>
              <excludeResources>true</excludeResources>
            </configuration>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>    
  </profiles>
</project>

