<?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="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>
  <parent>
    <groupId>org.apache.opennlp</groupId>
    <artifactId>opennlp</artifactId>
    <version>3.0.0-M4</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>opennlp-distr</artifactId>
  <packaging>pom</packaging>
  <name>Apache OpenNLP :: Distribution</name>

  <properties>
    <opennlp.version>${project.version}</opennlp.version>
  </properties>

  <!--  Versions will automatically be updated by the release plugin -->
  <dependencies>
    <!-- OpenNLP API -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-api</artifactId>
    </dependency>
    <!-- OpenNLP Core -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-model-resolver</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-formats</artifactId>
    </dependency>
    <!-- OpenNLP ML -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-ml-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-ml-maxent</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-ml-perceptron</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-ml-bayes</artifactId>
    </dependency>
    <!-- OpenNLP Toolkit -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-tools</artifactId>
    </dependency>
    <!-- OpenNLP Extensions -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-morfologik</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-uima</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-spellcheck</artifactId>
    </dependency>

    <!-- OpenNLP Docs - Ensure that "docs" are build before distribution -->
    <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-docs</artifactId>
    </dependency>

    <!-- ship the dist with a logging impl for cli users -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <version>${log4j2.version}</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.ruleoftech</groupId>
        <artifactId>markdown-page-generator-plugin</artifactId>
        <version>2.5.2</version>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <inputDirectory>${basedir}/../</inputDirectory>
          <outputDirectory>${basedir}/target</outputDirectory>
          <headerHtmlFile>${basedir}/README_HEADER.html</headerHtmlFile>
          <footerHtmlFile>${basedir}/README_FOOTER.html</footerHtmlFile>
          <pegdownExtensions>TABLES,FENCED_CODE_BLOCKS,AUTOLINKS</pegdownExtensions>
          <!-- needed for the opennlp.version property -->
          <applyFiltering>true</applyFiltering>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>bundle-project-sources</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/bin.xml</descriptor>
                <descriptor>src/main/assembly/src.xml</descriptor>
              </descriptors>
              <!-- Tar package is only compatible with gnu tar,
                   many file have more than 100 chars.
                   Right now only javadoc files are too long.
               -->
              <tarLongFileMode>posix</tarLongFileMode>

              <finalName>apache-opennlp-${project.version}</finalName>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>generate checksums for binary artifacts</id>
            <goals><goal>run</goal></goals>
            <phase>verify</phase>
            <configuration>
              <target>
                <checksum algorithm="sha-512" format="MD5SUM" fileext=".sha512">
                  <fileset dir="${project.build.directory}">
                    <include name="*.zip" />
                    <include name="*.gz" />
                  </fileset>
                </checksum>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>apache-release</id>

      <build>
        <!-- Run jira report -->
        <!-- depends on having -DjiraVersion set -->
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-changes-plugin</artifactId>
            <version>2.12.1</version>
            <executions>
              <execution>
                <id>default-cli</id>
                <phase>generate-resources</phase>
                <goals><goal>jira-report</goal></goals>
                <configuration>
                  <useJql>true</useJql>
                  <onlyCurrentVersion>true</onlyCurrentVersion>
                  <outputDirectory>${basedir}/target/issuesFixed/</outputDirectory>
                  <maxEntries>1000</maxEntries> <!-- hopefully, bigger than ever needed -->
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>1.2.2</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <imageName>apacheopennlp</imageName>
              <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
              <imageTags>
                <imageTag>${project.version}</imageTag>
              </imageTags>
              <buildArgs>
                <OPENNLP_BINARY>apache-opennlp-${project.version}-bin.tar.gz</OPENNLP_BINARY>
              </buildArgs>
              <resources>
                <resource>
                  <targetPath>/</targetPath>
                  <directory>${project.build.directory}</directory>
                  <include>apache-opennlp-${project.version}-bin.tar.gz</include>
                </resource>
              </resources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
