<?xml version='1.0' encoding='UTF-8'?>
<!--
  ~ Copyright (c) jGuru Europe AB.
  ~ All rights reserved.
  -->

<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>

    <!--
    ################################################
    # Section 1:  Project information
    ################################################
    -->
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>

    <groupId>se.jguru.codestyle</groupId>
    <artifactId>jguru-codestyle-reactor</artifactId>
    <version>1.1.0</version>
    <name>${project.artifactId}</name>
    <url>${site.top.url}/${path.in.reactor}</url>
    <description>jGuru Codestyle: Reactor (POM, version ${project.version})</description>
    <packaging>pom</packaging>
    <inceptionYear>2018</inceptionYear>

    <organization>
        <name>jGuru Europe AB</name>
        <url>https://www.jguru.se/</url>
    </organization>

    <prerequisites>
        <maven>${maven.version}</maven>
    </prerequisites>

    <licenses>
        <license>
            <name>jGuru Europe Corporate Source License, based on The Apache Software License, Version 2.0</name>
            <url>https://www.jguru.se/licenses/jguruCorporateSourceLicense-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>lj</id>
            <name>Lennart Jörelid</name>
            <email>lj@jguru.se</email>
            <roles>
                <role>Committer</role>
            </roles>
            <organization>jGuru Europe AB</organization>
            <organizationUrl>https://www.jguru.se</organizationUrl>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <properties>
        <!--
            Define the URL prefixes for Site Deployment and DistributionManagement.
            These can be overridden in sub-reactors to tailor releases to other locations.
        -->
        <reactor.name>jguru-codestyle</reactor.name>
        <path.in.reactor />

        <!--
            Define URL prefixes used in the various URL settings of the POM.
        -->
        <github.global.server>nazgul_github</github.global.server>
        <git.repo.owner>lennartj</git.repo.owner>
        <git.repo.url.prefix>https://github.com/${git.repo.owner}</git.repo.url.prefix>
        <git.scm.url.prefix>scm:git:ssh://git@github.com/${git.repo.owner}</git.scm.url.prefix>
        <site.url.prefix>http://${git.repo.owner}.github.io</site.url.prefix>
        <site.top.url>${site.url.prefix}/${reactor.name}/Documentation/${project.version}</site.top.url>

        <scm.connection.url>scm:git:${git.repo.url.prefix}/${reactor.name}.git</scm.connection.url>
        <scm.devConnection.url>${git.scm.url.prefix}/${reactor.name}.git</scm.devConnection.url>
        <distroManagement.url>${site.top.url}/${path.in.reactor}</distroManagement.url>
        <scm.url>${git.repo.url.prefix}/${reactor.name}.git</scm.url>
        <site.staging.localDirectory>/tmp/${reactor.name}</site.staging.localDirectory>

        <!-- Build definitions and Version properties -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jdk.version>11</jdk.version>
        <maven.version>3.8.1</maven.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <scm.provider.version>1.11.2</scm.provider.version>

        <!-- Code style properties -->
        <wtp.version>2.0</wtp.version>
        <clean.plugin.version>3.1.0</clean.plugin.version>
        <maven-project-info-reports-plugin.version>3.1.1</maven-project-info-reports-plugin.version>
        <versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>

        <!-- Site plugin properties -->
        <maven-site-plugin.version>3.9.1</maven-site-plugin.version>
        <doxia-modules.version>1.8</doxia-modules.version>
        <wagon-modules.version>2.9</wagon-modules.version>
        <kotlin.version>1.5.21</kotlin.version>
        <kotlin.jvm.target>11</kotlin.jvm.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!--
    ################################################
    # Section 2:  Modules
    ################################################
    -->
    <modules>
        <module>codestyle</module>
        <module>annotations</module>
        <module>poms</module>
    </modules>

    <!--
    ################################################
    # Section 3:  Build settings
    ################################################
    -->
    <build>
        <pluginManagement>
            <plugins>

                <!--
                    Up the version of the source plugin.

                    Why:  Use a newer source plugin version.
                    Used: Only when called, typically release profile.
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>

                <!--
                    Setup the Toolchains plugin to define the Java9 VM.

                    Why:  Define the 
                    Used: Only when called.
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-toolchains-plugin</artifactId>
                    <version>3.0.0</version>
                    <configuration>
                        <toolchains>
                            <jdk>
                                <version>${jdk.version}</version>
                                <vendor>oracle</vendor>
                            </jdk>
                        </toolchains>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>toolchain</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!--
                    Use a working version of the Maven versions plugin.

                    Why:  Workaround for https://jira.codehaus.org/browse/MVERSIONS-236
                    Used: Only when called.
                -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                </plugin>

                <!--
                    Specify the version of the GPG plugin

                    Why:  Used to sign artifacts.
                    Used: To sign artifacts, using GPG.
                -->
                <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>
                        </execution>
                    </executions>
                </plugin>

                <!--
                    Configure the javadoc plugin not to fail on standard HTML
                    constructs when building using JDK 8.
                    Typical standard constructs include empty tags, like: <p />
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <failOnError>false</failOnError>
                        <stylesheet>java</stylesheet>
                        <groups>
                            <group>
                                <title>jGuru Codestyle</title>
                                <packages>se.jguru.codestyle.*</packages>
                            </group>
                            <group>
                                <title>Nazgul Framework: Tools Packages</title>
                                <packages>se.jguru.nazgul.tools.*</packages>
                            </group>
                            <group>
                                <title>Nazgul Framework: Core Packages</title>
                                <packages>se.jguru.nazgul.core.*</packages>
                            </group>
                            <group>
                                <title>Nazgul Framework: Test Artifact Packages</title>
                                <packages>se.jguru.nazgul.test.*</packages>
                            </group>
                        </groups>
                        <useStandardDocletOptions>true</useStandardDocletOptions>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <docencoding>${project.build.sourceEncoding}</docencoding>
                        <charset>${project.build.sourceEncoding}</charset>
                        <breakiterator>true</breakiterator>
                        <version>true</version>
                        <author>true</author>
                        <keywords>true</keywords>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!--

                Configures the release plugin to use a custom release profile.

                Why:  Release artifacts
                Used: Normal lifecycle, release goal
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                    <arguments>-Pjguru-release</arguments>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <useReleaseProfile>false</useReleaseProfile>
                    <tagNameFormat>${reactor.name}-@{project.version}</tagNameFormat>
                    <goals>deploy</goals>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>${scm.provider.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-api</artifactId>
                        <version>${scm.provider.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!--
                Configure the javadoc plugin not to fail on standard HTML
                constructs when building using JDK 8.

                Typical standard constructs include empty tags, like: <p />
            -->
            <!-- plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>produce-javadocs</id>
                    </execution>
                </executions>
            </plugin -->

            <!--
                Configures the site plugin. Its use is further documented in the site documentation itself.

                Why:  Make compile and publish the Codestyle documentation.
                Used: Site lifecycle, mvn site.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven-site-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-descriptor</id>
                        <goals>
                            <goal>attach-descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-deploy</id>
                        <phase>site-deploy</phase>
                        <goals>
                            <goal />
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <topSiteURL>${site.url.prefix}/${reactor.name}</topSiteURL>
                    <stagingSiteURL>${site.url.prefix}/${reactor.name}</stagingSiteURL>
                    <stagingDirectory>${site.staging.localDirectory}</stagingDirectory>
                    <generateSitemap>true</generateSitemap>
                    <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
                    <outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
                </configuration>
            </plugin>

            <!--
                Provides Plantuml integration into site deployments.

                Why:  Convert Plantuml (*.puml) documents to png images, for use in site documentation.
                Used: Site lifecycle, mvn site.
            -->
            <plugin>
                <groupId>com.github.jeluard</groupId>
                <artifactId>plantuml-maven-plugin</artifactId>
                <version>7954</version>
                <configuration>
                    <sourceFiles>
                        <directory>${basedir}</directory>
                        <includes>
                            <include>src/site/**/*.puml</include>
                        </includes>
                    </sourceFiles>
                    <outputDirectory>${project.build.directory}/site/images/plantuml</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-plantuml-diagrams</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <phase>pre-site</phase>
                    </execution>
                </executions>
                <dependencies>
                    <!--
                        NOTE!

                        Do not upgrade the plantuml dependency above version 8030, as those plantuml releases
                        are not binary compatible with the plugin version 7954.
                    -->
                    <dependency>
                        <groupId>net.sourceforge.plantuml</groupId>
                        <artifactId>plantuml</artifactId>
                        <version>8030</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>${kotlin.jvm.target}</jvmTarget>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <outputDirectory>${project.build.directory}/site</outputDirectory>
        <plugins>

            <!--
                Configures the projects-info-reports plugin.

                Why:  Reduce the time consumed considerably by removing the need to acquire
                      dependency details and locations.
                Used: Site lifecycle, mvn site.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven-project-info-reports-plugin.version}</version>
                <configuration>
                    <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                </configuration>
            </plugin>

            <!--
                    Use a working version of the Maven versions plugin.

                    Why:  Workaround for https://jira.codehaus.org/browse/MVERSIONS-236
                    Used: Only when called.
                -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${versions-maven-plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <!--
    ################################################
    # Section 4:  External systems
    ################################################
    -->

    <!--
        Define the Continuous Build server address.
    -->
    <ciManagement>
        <system>TravisCI</system>
        <url>https://travis-ci.org/lennartj/jguru-codestyle</url>
    </ciManagement>

    <!--
        Define the issue management system.
    -->
    <issueManagement>
        <system>github</system>
        <url>https://github.com/lennartj/jguru-codestyle/issues</url>
    </issueManagement>

    <!--
        Define repository settings for Maven's deploy and release plugins.
        Move parts to settings.xml, as per recommendation within Maven specs.
    -->
    <distributionManagement>
        <repository>
            <id>ossrh-staging</id>
            <name>Sonatype OSS Nexus: Releases</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>ossrh-snapshots</id>
            <name>Sonatype OSS Nexus: Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <site>
            <id>github_site</id>
            <name>GitHub Site for jGuru Codestyle</name>
            <url>${site.top.url}/${path.in.reactor}</url>
        </site>
    </distributionManagement>

    <!--
        Define connections for Maven's VCS integration.
    -->
    <scm>
        <connection>${scm.connection.url}</connection>
        <developerConnection>${scm.devConnection.url}</developerConnection>
        <url>${scm.url}</url>
        <tag>jguru-codestyle-1.1.0</tag>
    </scm>

    <!--
    ################################################
    # Section 5:  Profiles
    ################################################
    -->
    <profiles>

        <!--
            Release profile for jGuru Codestyle Reactors.
        -->
        <profile>
            <id>jguru-release</id>
            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <updateReleaseInfo>true</updateReleaseInfo>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>none</phase>
                            </execution>
                            <execution>
                                <id>deploy-to-repo</id>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-jar-no-fork</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

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