<?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>
        <relativePath />
    </parent>

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

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

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

    <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>codestyle</path.in.reactor>

        <!-- Kotlin constants -->
        <kotlin.version>1.2.30</kotlin.version>
        <kotlin.jvm.target>1.8</kotlin.jvm.target>
        <kotlin.plugin>jpa</kotlin.plugin>
        
        <!--
            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>

        <maven.version>3.0</maven.version>
        <enforcer.api.version>1.4.1</enforcer.api.version>
        <jdk.version>1.8</jdk.version>

        <!-- Code style properties -->
        <pmd.plugin.version>3.8</pmd.plugin.version>
        <clover.plugin.version>4.2.1</clover.plugin.version>
        <spotbugs.plugin.version>3.1.1</spotbugs.plugin.version>
        <checkstyle.plugin.version>2.17</checkstyle.plugin.version>
        <checkstyle.header.java.file>codestyle/copyright/header_java.txt</checkstyle.header.java.file>
        <clean.plugin.version>2.6.1</clean.plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>

        <!-- Site plugin properties -->
        <maven-site-plugin.version>3.7</maven-site-plugin.version>
        <doxia-modules.version>1.8</doxia-modules.version>
        <wagon-modules.version>2.10</wagon-modules.version>
        <versions-maven-plugin.version>2.1.4</versions-maven-plugin.version>
    </properties>

    <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>http://www.jguru.se</organizationUrl>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <!--
    ################################################
    # Section 2:  Dependency (management) settings
    ################################################
    -->
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.enforcer</groupId>
            <artifactId>enforcer-api</artifactId>
            <version>${enforcer.api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${maven.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-container-default</artifactId>
            <scope>provided</scope>
            <version>1.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <version>1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!--
    ################################################
    # Section 3:  Build settings
    ################################################
    -->
    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>

        <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.0.1</version>
                </plugin>

                <!--
                    Use a working version of the Maven versions plugin.
                    (TODO: Update the Codehaus versions plugin with the fine additions done by Lars.)

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

                <!--
                    Upgrade the Compiler plugin to the latest version.

                    Why:  Use the latest compiler plugin version for upwards JDK compliance.
                    Used: For compiling all source code to binaries.
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>

                <!--
                    Ensure that the kotlin-maven-plugin uses the standard src/main/kotlin
                    and src/test/kotlin directories.

                    Why:  Ensures standard placement for Kotlin sources.
                    Used: Standard lifecycle, mvn compile / test-compile.
                -->
                <plugin>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <version>${kotlin.version}</version>
                    <configuration>
                        <plugin>${kotlin.plugin}</plugin>
                        <jvmTarget>${jdk.version}</jvmTarget>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-noarg</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                    </dependencies>
                </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>1.6</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!--
                    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>2.5.3</version>
                    <configuration combine.self="override">
                        <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-providers-git</artifactId>
                            <version>1.9.4</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <!--
                 Ensure that the kotlin-maven-plugin uses the standard src/main/kotlin
                 and src/test/kotlin directories.

                 Why:  Ensures standard placement for Kotlin sources.
                 Used: Standard lifecycle, mvn compile / test-compile.
             -->
            <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>

            <!--
                Ensure that the compiler plugin ignores the Java directories.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <!--
                        Replacing default-compile as it is treated specially by maven
                     -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!--
                        Replacing default-testCompile as it is treated specially by maven
                     -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </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>
                        <phase>package</phase>
                        <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>

            <!--

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

            <!--
                Define OSGi bundle plugin version.

                Why:  Plugin used to generate OSGi Manifest headers in JARs.
                Used: As included in [sub]projects.
            -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <supportedProjectTypes>
                        <supportedProjectType>ejb</supportedProjectType>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>war</supportedProjectType>
                        <supportedProjectType>ear</supportedProjectType>
                    </supportedProjectTypes>
                    <instructions>
                        <_consumer-policy><![CDATA[$<range;[===,+)>]]></_consumer-policy>
                        <_provider-policy><![CDATA[$<range;[===,=+)>]]></_provider-policy>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Embed-Directory>lib</Embed-Directory>
                    </instructions>
                </configuration>
            </plugin>

            <!--
                Enforce not importing incorrect projects.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>enforce-imports</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.0.4,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>${jdk.version}</version>
                                </requireJavaVersion>&gt;
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--
                Use a standard Kotlin source code formatter.
                Does not work with Java 9, unfortunately.

                Why:  Plugin used to provide source code Lint-ing.
                Used: Standard lifecycle, verify phase
            -->
            <!-- plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>ktlint</id>
                        <phase>verify</phase>
                        <configuration>
                            <target name="ktlint">
                                <java taskname="ktlint" dir="${basedir}"
                                      fork="true"
                                      failonerror="false"
                                      classpathref="maven.plugin.classpath"
                                      classname="com.github.shyiko.ktlint.Main">
                                    <arg value="src/main/kotlin/**/*.kt" />
                                    < ! - - Generates a Checkstyle-formatted report.

                                        C.f. https://github.com/shyiko/ktlint#usage
                                    - - >
                                    <arg value="- -reporter=plain" />
                                    <arg value="- -reporter=checkstyle,output=${project.build.directory}/ktlint.xml" />
                                </java>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>ktlint-format</id>
                        <configuration>
                            <target name="ktlint">
                                <java taskname="ktlint" dir="${basedir}" fork="true" failonerror="true" classpathref="maven.plugin.classpath" classname="com.github.shyiko.ktlint.Main">
                                    <arg value="-F" />
                                    <arg value="src/main/kotlin/**/*.kt" />
                                </java>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.github.shyiko</groupId>
                        <artifactId>ktlint</artifactId>
                        <version>0.15.0</version>
                    </dependency>
                </dependencies>
            </plugin -->
        </plugins>
    </build>

    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <outputDirectory>${project.build.directory}/site</outputDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.5</version>
            </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>de.lgohlke.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>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>ossrh-snapshots</id>
            <name>Sonatype OSS Nexus: Snapshots</name>
            <url>http://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-0.9.1</tag>
    </scm>

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

        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>

            <properties>

                <!-- Include Dokka -->
                <dokka.version>0.9.16</dokka.version>
                <dokka.outputFormat>javadoc</dokka.outputFormat>
            </properties>

            <build>
                <pluginManagement>
                    <plugins>

                        <!--
                            Dokka Maven Plugin provides javadoc-a-like documentation for Kotlin classes.
                            This plugin only works with JDK8, though, since it depends on the tools.jar
                            for its execution.
                        -->
                        <plugin>
                            <groupId>org.jetbrains.dokka</groupId>
                            <artifactId>dokka-maven-plugin</artifactId>
                            <version>${dokka.version}</version>
                            <configuration>
                                <outputDir>${project.reporting.outputDirectory}/dokka</outputDir>
                                <outputFormat>${dokka.outputFormat}</outputFormat>
                                <jdkVersion>8</jdkVersion>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>

                    <!--
                        Dokka Maven Plugin provides javadoc-a-like documentation for Kotlin classes.
                        This plugin only works with JDK8, though, since it depends on the tools.jar
                        for its execution.
                    -->
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka.version}</version>
                        <executions>
                            <execution>
                                <id>CreateJavaDocForSite</id>
                                <phase>pre-site</phase>
                                <goals>
                                    <goal>javadoc</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>IncludeJavaDocJarInRelease</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

        </profile>

        <!--
            Release profile for jGuru (Nazgul-component-style) reactors.
        -->
        <profile>
            <id>jguru-release</id>
            <build>

                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${maven-deploy-plugin.version}</version>
                        <configuration>
                            <updateReleaseInfo>true</updateReleaseInfo>
                        </configuration>
                    </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-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>