<?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>

  <groupId>org.carrot2</groupId>
  <artifactId>morfologik-parent</artifactId>
  <version>2.2.0</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>
    <maven.compiler.release>11</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <version.maven>3.9.12</version.maven>
    <version.assertj>3.27.7</version.assertj>
    <version.hppc>0.7.2</version.hppc>
    <version.junit>6.0.3</version.junit>
    <version.randomizedtesting>0.2.0</version.randomizedtesting>

    <version.maven-compiler-plugin>3.15.0</version.maven-compiler-plugin>
    <version.maven-enforcer-plugin>3.6.2</version.maven-enforcer-plugin>
    <version.maven-clean-plugin>3.5.0</version.maven-clean-plugin>
    <version.maven-jar-plugin>3.5.0</version.maven-jar-plugin>

    <version.forbiddenapis>3.10</version.forbiddenapis>
    <forbiddenapis.signaturefile>src/forbidden-apis/signatures.txt</forbiddenapis.signaturefile>
  </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>

  <dependencies>
    <dependency>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>randomizedtesting-jupiter</artifactId>
        <version>${version.randomizedtesting}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</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>
    <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>3.1.4</version>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.12.0</version>
          <configuration>
            <sourcepath>src/main/java</sourcepath>
            <doclint>all,-missing</doclint>
          </configuration>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${version.maven-jar-plugin}</version>
          <configuration>
            <archive>
              <addMavenDescriptor>false</addMavenDescriptor>
              <manifestEntries>
                <Project-GroupId>${project.groupId}</Project-GroupId>
                <Project-ArtifactId>${project.artifactId}</Project-ArtifactId>
                <Project-Version>${project.version}</Project-Version>
                <Project-Name>${project.name}</Project-Name>

                <Automatic-Module-Name>${project.moduleId}</Automatic-Module-Name>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.10.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${version.maven-compiler-plugin}</version>
        </plugin>

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

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.5</version>
        </plugin>
        
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${version.maven-enforcer-plugin}</version>
        </plugin>

        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>3.4.0</version>
          <configuration>
            <java>
              <googleJavaFormat>
                <version>1.35.0</version>
                <reflowLongStrings>true</reflowLongStrings>
                <formatJavadoc>true</formatJavadoc>
              </googleJavaFormat>
              <lineEndings>UNIX</lineEndings>
            </java>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-java-version</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[21,)</version>
                  <message>JDK 21 or newer is required to build this project.</message>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-dependency-convergence</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <rules>
                <DependencyConvergence/>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <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>

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

        <executions>
          <execution>
            <id>forbidden-apis</id>
            <configuration>
              <targetVersion>${maven.compiler.release}</targetVersion>
              <failOnUnsupportedJava>false</failOnUnsupportedJava>
              <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>

  <profiles>
    <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>eclipse</id>
      <build>
        <defaultGoal>compile antrun:run</defaultGoal>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>3.2.0</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.10.15</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>
                        <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>

      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.10.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <deploymentName>morfologik-stemming-${project.version}</deploymentName>
              <autoPublish>true</autoPublish>
              <waitUntil>published</waitUntil>
            </configuration>
          </plugin>

          <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>

