<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>nl.inl.blacklab</groupId>
    <artifactId>blacklab-all</artifactId>
    <packaging>pom</packaging>
    <version>2.2.0</version>
    <name>BlackLab Corpus Search</name>
    <description>The parent project for BlackLab Core and BlackLab Server.</description>
    <url>https://github.com/INL/BlackLab</url>

    <modules>
        <module>util</module>
        <module>common</module>
        <module>interfaces</module>
        <module>content-store</module>
        <module>engine</module>
        <module>text-pattern</module>
        <module>query-parser</module>
        <module>tools</module>
        <module>mocks</module>

        <module>core</module>
        <module>server</module>

        <module>contrib/convert-and-tag</module>
        <module>contrib/legacy-docindexers</module>
        <module>instrumentation/instrumentation</module>
        <module>instrumentation/instrumentation-impl</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <doclint>none</doclint>
        <blacklab.luceneVersion>5.5.5</blacklab.luceneVersion>
        <blacklab.version>${project.version}</blacklab.version>
        <log4j.version>2.17.1</log4j.version>
        <jackson.version>2.11.1</jackson.version>
        <eclipse.collections.version>7.1.0</eclipse.collections.version>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <maven.compiler.release>8</maven.compiler.release>
    </properties>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <organization>
        <name>Instituut voor Nederlandse Taal (INT)</name>
        <url>https://www.ivdnt.org/</url>
    </organization>

    <scm>
        <url>https://github.com/INL/BlackLab</url>
        <connection>scm:git:git://github.com/INL/BlackLab.git</connection>
        <developerConnection>scm:git:git@github.com:INL/BlackLab.git</developerConnection>
    </scm>

    <issueManagement>
        <url>https://github.com/INL/BlackLab/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <developers>
        <developer>
            <id>jan-niestadt</id>
            <name>Jan Niestadt</name>
            <email>jan.niestadt@ivdnt.org</email>
            <url>https://github.com/jan-niestadt</url>
            <organization>INT</organization>
            <organizationUrl>http://www.inl.nl</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Amsterdam</timezone>
        </developer>
        
        <developer>
            <id>KCMertens</id>
            <name>Koen Mertens</name>
            <email>koen.mertens@ivdnt.org</email>
            <url>https://github.com/KCMertens</url>
            <organization>INL</organization>
            <organizationUrl>https://www.ivdnt.org/</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Amsterdam</timezone>
        </developer>
    </developers>

    <contributors>
        <contributor>
            <name>Jesse de Does</name>
            <email>jesse.dedoes@ivdnt.org</email>
            <organization>INT</organization>
            <organizationUrl>https://www.ivdnt.org/</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Amsterdam</timezone>
        </contributor>
        
        <contributor>
            <name>Eduard Drenth</name>
            <email>edrenth@fryske-akademy.nl</email>
            <organization>Fryske Akademy</organization>
            <organizationUrl>https://www.fryske-akademy.nl/</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Amsterdam</timezone>
        </contributor>
    </contributors>

    <!-- Where releases are deployed (OSSRH, for publishing to Maven Central) -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>

        <plugins>

            <!-- Copies dependencies to target/lib, so we can run programs 
                from blacklab.jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Creates the JAR and the included manifest file -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <useDefaultManifestFile>true</useDefaultManifestFile>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                        <manifestEntries>
                            <Build-Time>${buildNumber}</Build-Time>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.0</version>
            </plugin>

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

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <!--<version>3.0.0-M1</version>-->
                <version>2.22.1</version>
                <configuration>
                    <!-- deal with Debian openjdk-8 issue (see https://issues.apache.org/jira/browse/SUREFIRE-1588) -->
                    <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
                    <!--
                    NOTE: this should enable parallel testing, but it causes errors. Look into this.
                    <parallel>classes</parallel>
                    <useUnlimitedThreads>true</useUnlimitedThreads>
                    <forkCount>3</forkCount>
                    -->
                </configuration>
            </plugin>

            <!-- Generates a "build number" (just a timestamp in our case)
                to put in the manifest -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
                    <items>
                        <item>timestamp</item>
                    </items>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Generates project site -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
                <dependencies>

                    <!-- SSH/SCP (copy to local server) -->
                    <dependency>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh</artifactId>
                        <version>2.9</version>
                    </dependency>
                    <dependency><!-- use external ssh (ssh or putty/pageant on windows) -->
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh-external</artifactId>
                        <version>2.9</version>
                    </dependency>

                </dependencies>
            </plugin>

            <!-- Linkable source code -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.5</version>
            </plugin>

            <!-- Report on (possible) bugs -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.5</version>
                <configuration>
                    <excludeFilterFile>${project.parent.basedir}/findbugs-exclude.xml</excludeFilterFile>
                </configuration>
            </plugin>

            <!-- Project info -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <source>8</source>
                    <notimestamp>true</notimestamp>
                </configuration>
            </plugin>

            <!-- Unit test reports -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.18.1</version>
            </plugin>

            <!-- Test code coverage -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.1</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains 
                                the execution data. -->

                            <dataFile>target/jacoco.exec</dataFile>
                            <!-- Sets the output directory for the code coverage 
                                report. -->
                            <outputDirectory>target/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <systemPropertyVariables>
                        <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <!-- Creates a release version -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

            <!-- Deploy a release to the OSSRH Nexus Repository Manager (for deploying to Maven Central) -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.3</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>

                    <!-- Create a source jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>     

                    <!-- Create a javadoc jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <source>8</source>
                            <notimestamp>true</notimestamp>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Sign components using GPG -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>      

                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>

        <!-- Testing (JUnit and Mockito) -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.20.1</version>
            <scope>test</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Apache Commons libs -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.7</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.21</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.4</version>
        </dependency>
        <!-- For indexing from tabular files: csv, tsv -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.4</version>
        </dependency>


    </dependencies>

    <reporting>
        <plugins>

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

            <!-- Project info section of the project site -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>dependencies</report>
                            <report>dependency-info</report>
                            <!-- <report>index</report> -->
                            <report>issue-management</report>
                            <report>licenses</report>
                            <report>plugin-management</report>
                            <report>plugins</report>
                            <report>team</report>
                            <!-- <report>mailing-list</report> <report>cim</report> -->
                            <report>scm</report>
                            <report>summary</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <source>8</source>
                    <notimestamp>true</notimestamp>
                </configuration>
                <reportSets>
                    <reportSet>
                        <id>html</id>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <!-- Report on possible bugs/style problems -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.12.0</version>
                <configuration>
                    <rulesets>
                        <!-- TODO: These appear to be ignored..? -->
                        <ruleset>${project.parent.basedir}/pmd-rules.xml</ruleset>
                    </rulesets>
                    <linkXref>true</linkXref>
                    <sourceEncoding>utf-8</sourceEncoding>
                    <minimumTokens>100</minimumTokens>
                    <targetJdk>1.8</targetJdk>
                    <excludes>
                        <exclude>**/queryParser/**/*</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!-- Report on style problems -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <configLocation>${project.parent.basedir}/checkstyle.xml</configLocation>
                    <excludes>**/queryParser/**/*,**/util/json/**/*</excludes>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <!-- Report on tags like TODO, etc. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <tagListOptions>
                        <tagClasses>
                            <tagClass>
                                <displayName>Bug or serious issue</displayName>
                                <tags>
                                    <tag>
                                        <matchString>FIXME</matchString>
                                        <matchType>exact</matchType>
                                    </tag>
                                    <tag>
                                        <matchString>hack</matchString>
                                        <matchType>ignoreCase</matchType>
                                    </tag>
                                </tags>
                            </tagClass>
                            <tagClass>
                                <displayName>Todo Work</displayName>
                                <tags>
                                    <tag>
                                        <matchString>todo</matchString>
                                        <matchType>ignoreCase</matchType>
                                    </tag>
                                    <tag>
                                        <matchString>TO DO</matchString>
                                        <matchType>exact</matchType>
                                    </tag>
                                </tags>
                            </tagClass>
                            <tagClass>
                                <displayName>Possible optimization</displayName>
                                <tags>
                                    <tag>
                                        <matchString>OPT</matchString>
                                        <matchType>exact</matchType>
                                    </tag>
                                </tags>
                            </tagClass>
                        </tagClasses>
                    </tagListOptions>
                </configuration>
            </plugin>

            <!-- Report on dependency versions -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.2</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>dependency-updates-report</report>
                            <report>plugin-updates-report</report>
                            <!-- <report>property-updates-report</report> -->
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

        </plugins>

    </reporting>

</project>
