<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.github.iamnicknack.simple-lucene</groupId>
    <artifactId>simple-lucene-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.1.2</version>

    <name>Simple Lucene</name>
    <description>Simplifies integration of Lucene</description>
    <url>https://iamnicknack.github.io/simple-lucene/</url>

    <modules>
        <module>simple-lucene-api</module>
        <module>simple-lucene-annotations</module>
        <module>simple-lucene-core</module>
    </modules>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Nick Sharples</name>
            <organizationUrl>https://github.com/iamnicknack</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh://github.com:iamnicknack/simple-lucene.git</connection>
        <developerConnection>scm:git:ssh://github.com:iamnicknack/simple-lucene.git</developerConnection>
        <url>https://github.com/iamnicknack/simple-lucene</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <lucene.version>9.3.0</lucene.version>
        <jackson.version>2.13.3</jackson.version>
        <junit.version>5.9.0</junit.version>
        <mockito.version>4.6.1</mockito.version>
        <assertj.version>3.23.1</assertj.version>
        <slf4j.version>1.7.36</slf4j.version>
        <logback.version>1.2.11</logback.version>

        <maven-javadoc.version>3.4.0</maven-javadoc.version>
        <maven-sources.version>3.2.1</maven-sources.version>
        <maven-gpg.version>3.0.1</maven-gpg.version>
        <maven-checksum.version>1.11</maven-checksum.version>
        <surefire.version>3.0.0-M7</surefire.version>
        <jacoco.version>0.8.8</jacoco.version>
        <nexus-staging.version>1.6.13</nexus-staging.version>

        <jacoco-branch-coverage>0.6</jacoco-branch-coverage>
        <jacoco-line-coverage>0.6</jacoco-line-coverage>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

        </dependencies>
    </dependencyManagement>


    <dependencies>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>${lucene.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-queryparser</artifactId>
            <version>${lucene.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-facet</artifactId>
            <version>${lucene.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>

                    <executions>
                        <execution>
                            <id>default-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>coverage-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <rule>
                                        <element>BUNDLE</element>
                                        <limits>
                                            <limit>
                                                <counter>BRANCH</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>${jacoco-branch-coverage}</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                    <rule>
                                        <element>BUNDLE</element>
                                        <limits>
                                            <limit>
                                                <counter>LINE</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>${jacoco-line-coverage}</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </pluginManagement>

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

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>development</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <modules>
                <module>simple-lucene-aspects</module>
                <module>simple-lucene-sandbox</module>
                <module>examples</module>
            </modules>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>${maven-javadoc.version}</version>
                            <configuration>
                                <nohelp>true</nohelp>
                                <excludePackageNames>io.github.iamnicknack.slc.examples.*;io.github.iamnicknack.slc.aspect;slc.*;</excludePackageNames>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>attach-javadoc</id>
                                    <goals>
                                        <goal>jar</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>

                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-source-plugin</artifactId>
                            <version>${maven-sources.version}</version>
                            <executions>
                                <execution>
                                    <id>attach-source</id>
                                    <goals>
                                        <goal>jar</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>

                        <plugin>
                            <groupId>net.nicoulaj.maven.plugins</groupId>
                            <artifactId>checksum-maven-plugin</artifactId>
                            <version>${maven-checksum.version}</version>
                            <executions>
                                <execution>
                                    <goals>
                                        <goal>artifacts</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>

                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>${maven-gpg.version}</version>
                            <executions>
                                <execution>
                                    <id>sign-artifacts</id>
                                    <phase>verify</phase>
                                    <goals>
                                        <goal>sign</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <gpgArguments>
                                    <arg>--pinentry-mode</arg>
                                    <arg>loopback</arg>
                                </gpgArguments>
                            </configuration>
                        </plugin>

                        <plugin>
                            <groupId>org.sonatype.plugins</groupId>
                            <artifactId>nexus-staging-maven-plugin</artifactId>
                            <version>${nexus-staging.version}</version>
                            <extensions>true</extensions>
                            <configuration>
                                <serverId>ossrh</serverId>
                                <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                                <autoReleaseAfterClose>false</autoReleaseAfterClose>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
                
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>

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

                    <plugin>
                        <groupId>net.nicoulaj.maven.plugins</groupId>
                        <artifactId>checksum-maven-plugin</artifactId>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>