<?xml version="1.0" encoding="UTF-8"?>

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0"
    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>

    <name>NLPCraft Parent</name>
    <groupId>org.apache.nlpcraft</groupId>
    <artifactId>nlpcraft-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <url>https://nlpcraft.apache.org</url>
    <description>An open source API to convert natural language into actions.</description>

    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>10</version>
    </parent>

    <modules>
        <module>nlpcraft</module>
    </modules>

    <developers>
        <developer>
            <id>aradzinski</id>
            <name>Aaron Radzinski</name>
            <email>aradzinski@apache.org</email>
            <organization>apache</organization>
            <organizationUrl>https://apache.org</organizationUrl>
            <roles>
                <role>architect</role>
            </roles>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/apache/incubator-nlpcraft.git</url>
        <connection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</developerConnection>
        <!-- Set actual tag name here -->
        <tag>v1.0.0</tag>
    </scm>

    <properties>
        <!-- Major Java/Scala version. -->
        <scala.major.ver>3</scala.major.ver>
        <scala3.ver>${scala.major.ver}.2.2</scala3.ver>

        <scala2.ver>2.13.10</scala2.ver>

        <java.ver>11</java.ver>
        <maven.build.timestamp.format>yyyy-MM-dd-HH-mm</maven.build.timestamp.format>
        <timestamp>${maven.build.timestamp}</timestamp>

        <!-- Versions. -->
        <scala.plugin.ver>4.6.3</scala.plugin.ver>
        <log4j.ver>2.19.0</log4j.ver>
        <scala.config.ver>1.3.4</scala.config.ver>
        <scala.logging.ver>3.9.5</scala.logging.ver>
        <scala.par.colections>1.0.4</scala.par.colections>
        <maven.jar.plugin.ver>3.2.2</maven.jar.plugin.ver>
        <maven.compiler.plugin.ver>3.8.1</maven.compiler.plugin.ver>
        <maven.enforcer.plugin.ver>1.4.1</maven.enforcer.plugin.ver>
        <maven.surefire.plugin.ver>2.22.1</maven.surefire.plugin.ver>
        <maven.scalatest.plugin.ver>2.1.0</maven.scalatest.plugin.ver>
        <maven.shade.plugin.ver>3.2.1</maven.shade.plugin.ver>
        <maven.project.info.reports.plugin.ver>2.2</maven.project.info.reports.plugin.ver>
        <maven.install.plugin.ver>2.5.2</maven.install.plugin.ver>
        <maven.source.plugin.ver>3.0.1</maven.source.plugin.ver>
        <maven.clean.plugin.ver>3.1.0</maven.clean.plugin.ver>
        <maven.javadoc.plugin.ver>3.2.0</maven.javadoc.plugin.ver>
        <apache.rat.plugin.ver>0.15</apache.rat.plugin.ver>
        <maven.gpg.plugin.ver>1.6</maven.gpg.plugin.ver>
        <org.antlr4.ver>4.11.1</org.antlr4.ver>
        <jline.ver>3.21.0</jline.ver>
        <commons.io.ver>2.11.0</commons.io.ver>
        <commons.lang3.ver>3.12.0</commons.lang3.ver>
        <commons.codec.ver>1.15</commons.codec.ver>
        <commons.collections.ver>4.4</commons.collections.ver>
        <scala3.ref.ver>1.2.0</scala3.ref.ver>
        <jackson.ver>2.13.4</jackson.ver>
        <jackson.yaml.ver>2.13.4</jackson.yaml.ver>
        <apache.opennlp.ver>2.1.0</apache.opennlp.ver>
        <gson.ver>2.10</gson.ver>
        <scalatest.ver>3.2.15</scalatest.ver>

        <!-- Force specific encoding on text resources. -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Jar with all dependencies. -->
        <nlpcraft.all.deps.jar>apache-${project.artifactId}-incubating-${project.version}-all-deps.jar</nlpcraft.all.deps.jar>

        <!--
            NOTE: this library is NOT included in binary build and is optional
            for NLPCraft. It is licensed under GPLv3 and has to be downloaded separately by
            the end user, when required.
        -->
        <stanford.corenlp.ver>4.5.1</stanford.corenlp.ver>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!--
                Scala3 dependencies.
                ===================
            -->

            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala3-library_${scala.major.ver}</artifactId>
                <version>${scala3.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala2.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.scala-lang.modules</groupId>
                <artifactId>scala-parallel-collections_${scala.major.ver}</artifactId>
                <version>${scala.par.colections}</version>
            </dependency>

            <dependency>
                <groupId>com.typesafe.scala-logging</groupId>
                <artifactId>scala-logging_${scala.major.ver}</artifactId>
                <version>${scala.logging.ver}</version>
            </dependency>

            <!--
             Other dependencies.
             ==================
            -->

            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.ver}</version>
            </dependency>

            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons.io.ver}</version>
            </dependency>

            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons.codec.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${commons.collections.ver}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-yaml</artifactId>
                <version>${jackson.ver}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.ver}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-scala_3</artifactId>
                <version>${jackson.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>${org.antlr4.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.opennlp</groupId>
                <artifactId>opennlp-tools</artifactId>
                <version>${apache.opennlp.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
                <version>${log4j.ver}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j.ver}</version>
            </dependency>

            <!--
             JLine dependencies.
             ==================
            -->
            <dependency>
                <groupId>org.jline</groupId>
                <artifactId>jline-terminal</artifactId>
                <version>${jline.ver}</version>
            </dependency>

            <!--
             Stanford dependencies.
             ==================
            -->

            <dependency>
                <groupId>edu.stanford.nlp</groupId>
                <artifactId>stanford-corenlp</artifactId>
                <version>${stanford.corenlp.ver}</version>
            </dependency>

            <dependency>
                <groupId>edu.stanford.nlp</groupId>
                <artifactId>stanford-corenlp</artifactId>
                <version>${stanford.corenlp.ver}</version>
                <classifier>models</classifier>
            </dependency>

            <!--
                Test scope.
                ===========
            -->
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scala.major.ver}</artifactId>
                <version>${scalatest.ver}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.plugin.ver}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala.plugin.ver}</version>
                <configuration>
                    <jvmArgs>
                        <jvmArg>-Xms512m</jvmArg>
                        <jvmArg>-Xmx4096m</jvmArg>
                        <jvmArg>-Xss2048k</jvmArg>
                    </jvmArgs>
                    <args>
                        <arg>-unchecked</arg>
                        <arg>-deprecation</arg>
                        <arg>-feature</arg>
                    </args>
                    <scalaCompatVersion>3</scalaCompatVersion>
                    <source>${java.ver}</source>
                    <target>${java.ver}</target>
                </configuration>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.ver}</version>
                <configuration>
                    <source>${java.ver}</source>
                    <target>${java.ver}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven.enforcer.plugin.ver}</version>
                <configuration>
                    <rules>
                        <requireJavaVersion>
                            <message>

                                ------------------------------------------------------------------------
                                You are trying to compile NLPCraft with inappropriate JDK version!
                                Detected JDK Version: ${java.runtime.version}.
                                JDK version should be 11 or later.
                                ------------------------------------------------------------------------

                            </message>
                            <version>11</version>
                        </requireJavaVersion>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.ver}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Stanford CoreNLP integration is not included by default due to GPL-licensed code. -->
        <profile>
            <id>stanford-core</id>
            <modules>
                <module>nlpcraft-stanford</module>
            </modules>
        </profile>

        <profile>
            <id>examples</id>
            <modules>
                <module>nlpcraft-examples/time</module>
                <module>nlpcraft-examples/lightswitch</module>
                <module>nlpcraft-examples/lightswitch-ru</module>
                <module>nlpcraft-examples/lightswitch-fr</module>
                <module>nlpcraft-examples/pizzeria</module>
                <module>nlpcraft-examples/calculator</module>
            </modules>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <version>${apache.rat.plugin.ver}</version>
                        <configuration>
                            <excludes>
                                <exclude>.gitignore</exclude>
                                <exclude>build</exclude>
                                <exclude>project/build.properties</exclude>
                                <exclude>project/plugins.sbt</exclude>
                                <exclude>project/target/scala-2.12/sbt-1.0/**/*</exclude>
                                <exclude>project/target/config-classes/**/*</exclude>
                                <exclude>project/project/target/config-classes/**/*</exclude>
                                <exclude>.idea/**/*</exclude>
                                <exclude>scaladoc/**/*</exclude>
                                <exclude>.git/**/*</exclude>
                                <exclude>venv</exclude>
                                <exclude>*.iml</exclude>
                                <exclude>**/*.txt</exclude>
                                <exclude>idea/**/*</exclude>
                                <exclude>zips/**/*</exclude>
                                <exclude>project/target/streams/**/*</exclude>
                                <exclude>project/target/config-classes/**/*</exclude>
                                <exclude>src/main/resources/moby/*</exclude>
                                <exclude>src/main/scala/org/apache/nlpcraft/internal/intent/compiler/antlr4/*</exclude>
                                <exclude>src/main/scala/org/apache/nlpcraft/internal/makro/antlr4/*</exclude>
                                <exclude>DISCLAIMER-WIP</exclude>
                            </excludes>
                            <numUnapprovedLicenses>0</numUnapprovedLicenses>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.ver}</version>
                        <configuration>
                            <keyname>${gpg.keyname}</keyname>
                            <passphrase>${gpg.passphrase}</passphrase>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
