<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.dellroad</groupId>
    <artifactId>java-console-toolkit</artifactId>
    <version>1.0.4</version>
    <packaging>pom</packaging>

    <name>Java Console Toolkit</name>
    <description>Toolkit for adding a command line interface (CLI) to a Java application</description>
    <url>https://github.com/archiecobbs/java-console-toolkit</url>

    <modules>
        <module>core</module>
        <module>demo</module>
        <module>jshell</module>
        <module>ssh</module>
    </modules>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/archiecobbs/java-console-toolkit/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/archiecobbs/java-console-toolkit/</url>
        <connection>scm:git:git://github.com/archiecobbs/java-console-toolkit.git</connection>
        <developerConnection>scm:git:git://github.com/archiecobbs/java-console-toolkit.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>archiecobbs</id>
            <name>Archie Cobbs</name>
            <email>archie.cobbs@gmail.com</email>
        </developer>
    </developers>
    <properties>

        <!-- Basic stuff -->
        <java.version>8</java.version>
        <checkstyle.config.location>src/checkstyle/checkstyle.xml</checkstyle.config.location>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Root package name -->
        <jct.package.root>org.dellroad.jct</jct.package.root>

        <!-- Dependency versions - Libraries -->
        <dellroad-stuff.version>2.5.10</dellroad-stuff.version>
        <jline.version>3.23.0</jline.version>
        <log4j.version>2.20.0</log4j.version>
        <slf4j.version>2.0.7</slf4j.version>
        <sshd.version>2.10.0</sshd.version>
        <testng.version>7.7.1</testng.version>

        <!-- Dependency versions - Plugins -->
        <maven-assembly-plugin.version>3.2.0</maven-assembly-plugin.version>
        <maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
        <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
        <maven-project-info-reports.plugin.version>2.9</maven-project-info-reports.plugin.version><!-- https://stackoverflow.com/a/51099913/263801 -->
        <maven-site-plugin.version>3.12.1</maven-site-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version>
        <properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
        <spotbugs-maven-plugin.version>4.7.3.4</spotbugs-maven-plugin.version>

    </properties>

    <dependencyManagement>
        <dependencies>

            <!-- Logging -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j2-impl</artifactId>
                <version>${log4j.version}</version>
            </dependency>

            <!-- DellRoad Stuff -->
            <dependency>
                <groupId>org.dellroad</groupId>
                <artifactId>dellroad-stuff-main</artifactId>
                <version>${dellroad-stuff.version}</version>
            </dependency>

            <!-- Apache MINA SSHD -->
            <dependency>
                <groupId>org.apache.sshd</groupId>
                <artifactId>sshd-osgi</artifactId>
                <version>${sshd.version}</version>
            </dependency>

            <!-- JLine -->
            <dependency>
                <groupId>org.jline</groupId>
                <artifactId>jline</artifactId>
                <version>${jline.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jline</groupId>
                <artifactId>jline-reader</artifactId>
                <version>${jline.version}</version>
            </dependency>

            <!-- TestNG -->
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
            </dependency>

            <!-- Sibling JARs -->
            <dependency>
                <groupId>org.dellroad</groupId>
                <artifactId>java-console-toolkit-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.dellroad</groupId>
                <artifactId>java-console-toolkit-jshell</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.dellroad</groupId>
                <artifactId>java-console-toolkit-ssh</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <distributionManagement>
        <downloadUrl>https://github.com/archiecobbs/java-console-toolkit</downloadUrl>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <site>
            <id>${project.artifactId}-site</id>
            <url>file://${project.basedir}/site/</url>
        </site>
    </distributionManagement>

    <build>
        <plugins>

            <!-- Avoid Mac OS X "Launcher" application appearing during build -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>${properties-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>set-system-properties</goal>
                        </goals>
                        <configuration>
                            <properties>
                                <property>
                                    <name>java.awt.headless</name>
                                    <value>true</value>
                                </property>
                            </properties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Java version enforcer -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[11,)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- Compile -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <release>${java.version}</release>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:all,-path</arg>
                        <arg>-Werror</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

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

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <validateLinks>true</validateLinks>
                    <links/>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <systemPropertyVariables>
                        <deleteTempDirs>true</deleteTempDirs>
                        <randomSeed/>
                    </systemPropertyVariables>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <value>10</value>
                        </property>
                    </properties>
                </configuration>
            </plugin>

            <!-- Checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-verify</id>
                        <phase>verify</phase>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <linkXRef>false</linkXRef>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- SpotBugs -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Default</threshold>
                    <xmlOutput>true</xmlOutput>
                    <excludeFilterFile>${project.basedir}/src/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
                    <failOnError>true</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Info Reports -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven-project-info-reports.plugin.version}</version>
                <!-- https://issues.apache.org/jira/browse/MPIR-370 -->
                <!--
                    <exclusions>
                        <exclusion>
                            <groupId>com.google.code.findbugs</groupId>
                            <artifactId>bcel-findbugs</artifactId>
                        </exclusion>
                    </exclusions>
                -->
            </plugin>
        </plugins>

    </build>
    <reporting>
        <plugins>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <inherited>false</inherited>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <links/>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    <profiles>

        <!-- Maven Central requires signed artifacts -->
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
