<?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>
    <parent>
        <groupId>org.dellroad</groupId>
        <artifactId>dellroad-dependencies</artifactId>
        <version>3.2.11.0</version>
    </parent>
    <artifactId>java-console-toolkit</artifactId>
    <version>1.1.0</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>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

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

        <!-- Dependency versions -->
        <sshd.version>2.15.0</sshd.version>
        <javabox.version>1.0.1</javabox.version>
        <testng.version>7.7.1</testng.version>
    </properties>

    <dependencyManagement>
        <dependencies>

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

            <!-- JavaBox -->
            <dependency>
                <groupId>org.dellroad</groupId>
                <artifactId>javabox-execution</artifactId>
                <version>${javabox.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>

            <!-- Maven enforcer -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>${extra-enforcer-rules.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>maven_enforcer</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>

                                <!-- Enforce Java version -->
                                <requireJavaVersion>
                                    <version>[${java.version},)</version>
                                    <display>false</display>
                                </requireJavaVersion>

                                <!-- Enforce maximum bytecode version among dependencies -->
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>${java.version}</maxJdkVersion>
                                    <excludes>
                                        <exclude>${project.groupId}:java-console-toolkit-jshell</exclude>
                                    </excludes>
                                    <ignoredScopes>
                                        <ignoredScopes>test</ignoredScopes>
                                    </ignoredScopes>
                                </enforceBytecodeVersion>

                                <!-- Enforce Maven version 3.6.3 or better -->
                                <!-- https://github.com/jgitver/jgitver-maven-plugin/issues/119 -->
                                <requireMavenVersion>
                                    <version>[3.6.3,)</version>
                                </requireMavenVersion>

                                <!-- Check for dependency conflicts -->
                                <!-- <dependencyConvergence/> -->
                                <banDuplicatePomDependencyVersions/>

                                <!-- Check for same class appearing more than once but not identically -->
                                <banDuplicateClasses>
                                    <findAllDuplicates>true</findAllDuplicates>
                                    <ignoreWhenIdentical>true</ignoreWhenIdentical>
                                </banDuplicateClasses>

                                <!-- Other rules -->
                                <reactorModuleConvergence/>
                            <!--
                                <requireUpperBoundDeps/>        See https://github.com/vaadin/spring/issues/1070
                            -->

                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

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

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

            <!-- Checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-verify</id>
                        <phase>verify</phase>
                        <configuration>
                            <failOnViolation>true</failOnViolation>
                            <includeResources>false</includeResources>
                            <includeTestResources>false</includeTestResources>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                            <configLocation>src/checkstyle/checkstyle.xml</configLocation>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Sources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <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>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <validateLinks>true</validateLinks>
                    <doclint>-reference,-missing</doclint>
                    <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>
                <configuration>
                    <systemPropertyVariables>
                        <deleteTempDirs>true</deleteTempDirs>
                        <randomSeed/>
                    </systemPropertyVariables>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <value>10</value>
                        </property>
                    </properties>
                </configuration>
            </plugin>

            <!-- SpotBugs -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Default</threshold>
                    <xmlOutput>true</xmlOutput>
                    <excludeFilterFile>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>
            </plugin>

            <!-- Site plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-scm</artifactId>
                <version>${maven-wagon-scm-extension.version}</version>
            </extension>
        </extensions>
    </build>
    <reporting>
        <plugins>

            <!-- Aggregated Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <validateLinks>true</validateLinks>
                    <aggregate>true</aggregate>
                    <doclint>-missing</doclint>
                    <links/>
                </configuration>
                <reportSets>
                    <reportSet>
                        <id>aggregate</id>
                        <inherited>false</inherited>
                        <reports>
                            <report>aggregate</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </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>
