<?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>1.9.4</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>
		<dependency>
			<groupId>org.apache.opennlp</groupId>
			<artifactId>opennlp-tools</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.opennlp</groupId>
			<artifactId>opennlp-uima</artifactId>
		</dependency>
		<dependency>
            <groupId>org.apache.opennlp</groupId>
            <artifactId>opennlp-morfologik-addon</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.opennlp</groupId>
            <artifactId>opennlp-brat-annotator</artifactId>
        </dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>com.ruleoftech</groupId>
				<artifactId>markdown-page-generator-plugin</artifactId>
				<version>1.0.0</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> 
	        <version>1.8</version>
	        <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>
                  <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>0.4.13</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>
