<?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>com.ensarsarajcic.neovim.java</groupId>
    <artifactId>parent</artifactId>
    <packaging>pom</packaging>
    <version>0.3.0</version>

    <modules>
        <!-- Core -->
        <module>core-rpc</module>
        <module>reactive-core-rpc</module>

        <!-- API -->
        <module>neovim-api</module>
        <module>neovim-rx-api</module>

        <!-- Extras -->
        <module>neovim-notifications</module>
        <module>handler-annotations</module>
        <module>unix-socket-connection</module>

        <!-- Testing -->
        <module>testing-helpers</module>

        <!-- Helpers -->
        <module>api-explorer</module>
        <module>rplugin-example</module>
    </modules>

    <name>neovim-java (Parent)</name>
    <description>Java Client for Neovim API</description>
    <url>https://www.ensarsarajcic.com/neovim-java</url>

    <scm>
        <url>https://github.com/esensar/neovim-java</url>
        <connection>scm:git:https://github.com/esensar/neovim-java.git</connection>
        <developerConnection>scm:git:git@github.com:esensar/neovim-java.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/esensar/neovim-java/issues</url>
    </issueManagement>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <email>es.ensar@gmail.com</email>
            <name>Ensar Sarajčić</name>
            <url>https://ensarsarajcic.com</url>
            <id>esensar</id>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>4.13.2</junit.version>
        <mockito.version>4.5.1</mockito.version>
        <assertj.version>3.22.0</assertj.version>
        <msgpack.version>0.9.1</msgpack.version>
        <rxjava2.version>2.1.14</rxjava2.version>
        <jackson.databind.version>2.13.3</jackson.databind.version>
        <apache.commons.version>3.12.0</apache.commons.version>
        <slf4j.version>1.7.36</slf4j.version>
        <reflections.version>0.10.2</reflections.version>
        <ipcsocket.version>1.4.0</ipcsocket.version>
        <asm.version>7.2</asm.version>
        <java.version>17</java.version>
        <javafx.version>17.0.1</javafx.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.12.10</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.objenesis</groupId>
            <artifactId>objenesis</artifactId>
            <version>3.2</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <!-- Repository for snapshots -->
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <!-- Repository for releases -->
        <repository>
            <id>ossrh</id>
            <name>Nexus Release Repository</name>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Enforce maven 3.x -->
                <plugin>
                    <inherited>true</inherited>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.3.1</version>
                    <executions>
                        <execution>
                            <id>enforce-maven-3</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <banDuplicatePomDependencyVersions/>
                                    <requireMavenVersion>
                                        <version>3.5</version>
                                    </requireMavenVersion>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <release>${java.version}</release>
                        <useIncrementalCompilation>false</useIncrementalCompilation>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.ow2.asm</groupId>
                            <artifactId>asm</artifactId>
                            <version>${asm.version}</version> <!-- Use newer version of ASM -->
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M5</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.ow2.asm</groupId>
                            <artifactId>asm</artifactId>
                            <version>${asm.version}</version> <!-- Use newer version of ASM -->
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.13</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.0-M5</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <useReleaseProfile>false</useReleaseProfile>
                        <releaseProfiles>release</releaseProfiles>
                        <goals>deploy nexus-staging:release</goals>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.1.2</version>
                    <configuration>
                        <failsOnError>true</failsOnError>
                        <configLocation>checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <excludes>**/module-info.java</excludes>

                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>github</id>
            <repositories>
                <repository>
                    <id>github</id>
                    <name>GitHub esensar neovim-java Apache Maven Packages</name>
                    <url>https://maven.pkg.github.com/esensar/neovim-java</url>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-source-plugin</artifactId>
                            <version>3.2.1</version>
                            <executions>
                                <execution>
                                    <id>attach-sources</id>
                                    <goals>
                                        <goal>jar-no-fork</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>3.3.2</version>
                            <dependencies>
                                <dependency>
                                    <groupId>org.ow2.asm</groupId>
                                    <artifactId>asm</artifactId>
                                    <version>${asm.version}</version> <!-- Use newer version of ASM -->
                                </dependency>
                            </dependencies>
                            <executions>
                                <execution>
                                    <id>attach-javadocs</id>
                                    <goals>
                                        <goal>jar</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>3.0.1</version>
                            <executions>
                                <execution>
                                    <id>sign-artifacts</id>
                                    <phase>verify</phase>
                                    <goals>
                                        <goal>sign</goal>
                                    </goals>
                                    <configuration>
                                        <gpgArguments>
                                            <arg>--pinentry-mode</arg>
                                            <arg>loopback</arg>
                                        </gpgArguments>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <artifactId>maven-deploy-plugin</artifactId>
                            <version>3.0.0-M2</version>
                            <executions>
                                <execution>
                                    <id>default-deploy</id>
                                    <phase>deploy</phase>
                                    <goals>
                                        <goal>deploy</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

</project>
