<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
<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.ops4j</groupId>
        <artifactId>master</artifactId>
        <version>4.3.0</version>
    </parent>

    <groupId>org.ops4j</groupId>
    <artifactId>tools</artifactId>
    <version>0.1.1</version>
    <packaging>pom</packaging>

    <name>OPS4J Tools</name>

    <description>OPS4J Tools project provides utilities to be used with popular tools like Maven.</description>

    <url>https://ops4j1.jira.com/wiki/spaces/TOOLS/overview</url>
    <inceptionYear>2019</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>ggrzybek</id>
            <name>Grzegorz Grzybek</name>
            <email>gr.grzybek@gmail.com</email>
            <roles>
                <role>Developer</role>
            </roles>
            <timezone>UTC+1</timezone>
        </developer>
    </developers>

    <modules>
        <module>maven</module>
    </modules>

    <scm>
        <connection>scm:git:git@github.com:ops4j/org.ops4j.tools.git</connection>
        <developerConnection>scm:git:git@github.com:ops4j/org.ops4j.tools.git</developerConnection>
        <tag>tools-0.1.1</tag>
        <url>https://github.com/ops4j/org.ops4j.tools</url>
    </scm>

    <issueManagement>
        <system>Jira</system>
        <url>https://ops4j1.jira.com/projects/TOOLS/summary</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- versions of Maven plugins -->

        <!-- Plugins from org.apache.maven.plugins -->
        <version.plugin.maven-checkstyle-plugin>3.0.0</version.plugin.maven-checkstyle-plugin>
        <version.com.puppycrawl.tools.checkstyle>8.17</version.com.puppycrawl.tools.checkstyle>
        <version.plugin.maven-clean-plugin>3.1.0</version.plugin.maven-clean-plugin>
        <version.plugin.maven-checkstyle-plugin>3.0.0</version.plugin.maven-checkstyle-plugin>
        <version.plugin.maven-compiler-plugin>3.8.0</version.plugin.maven-compiler-plugin>
        <version.plugin.maven-deploy-plugin>2.8.2</version.plugin.maven-deploy-plugin>
        <version.plugin.maven-enforcer-plugin>3.0.0-M1</version.plugin.maven-enforcer-plugin>
        <version.org.commonjava.maven.enforcer>1.3</version.org.commonjava.maven.enforcer>
        <version.plugin.maven-install-plugin>2.5.2</version.plugin.maven-install-plugin>
        <version.plugin.maven-invoker-plugin>3.2.0</version.plugin.maven-invoker-plugin>
        <version.plugin.maven-jar-plugin>3.1.1</version.plugin.maven-jar-plugin>
        <version.plugin.maven-plugin-plugin>3.6.0</version.plugin.maven-plugin-plugin>
        <version.plugin.maven-resources-plugin>3.1.0</version.plugin.maven-resources-plugin>
        <version.plugin.maven-site-plugin>3.7.1</version.plugin.maven-site-plugin>
        <version.plugin.maven-surefire-plugin>2.22.1</version.plugin.maven-surefire-plugin>

        <!-- Other plugins -->
        <!--<version.plugin.apache.apache-rat-plugin>0.13</version.plugin.apache.apache-rat-plugin>-->
        <!--<version.plugin.asciidoctor-maven-plugin>1.5.6</version.plugin.asciidoctor-maven-plugin>-->
        <!--<version.org.asciidoctor>1.5.8</version.org.asciidoctor>-->
        <version.plugin.codehaus.plexus-component-metadata>1.7.1</version.plugin.codehaus.plexus-component-metadata>
        <version.plugin.mojo.build-helper-maven-plugin>3.0.0</version.plugin.mojo.build-helper-maven-plugin>
        <version.plugin.mycila.license-maven-plugin>3.0</version.plugin.mycila.license-maven-plugin>
        <version.plugin.sonatype.nexus-staging-maven-plugin>1.6.8</version.plugin.sonatype.nexus-staging-maven-plugin>

        <!-- versions of Maven dependencies -->

        <version.org.apache.felix.utils>1.11.2</version.org.apache.felix.utils>
        <version.org.apache.maven>3.6.0</version.org.apache.maven>
        <version.org.apache.maven.shared.filtering>3.1.1</version.org.apache.maven.shared.filtering>
        <version.org.assertj>3.11.1</version.org.assertj>
        <version.org.junit.jupiter>5.3.2</version.org.junit.jupiter>
        <version.org.mockito>2.23.4</version.org.mockito>
        <version.org.slf4j>1.7.25</version.org.slf4j>
    </properties>

    <dependencyManagement>
        <dependencies>

            <!-- Felix -->

            <dependency>
                <groupId>org.apache.felix</groupId>
                <artifactId>org.apache.felix.utils</artifactId>
                <version>${version.org.apache.felix.utils}</version>
            </dependency>

            <!-- Maven -->

            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${version.org.apache.maven}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${version.org.apache.maven}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>${version.org.apache.maven}</version>
            </dependency>

            <!-- Logging -->

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.org.slf4j}</version>
            </dependency>

            <!-- Test -->

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${version.org.assertj}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${version.org.mockito}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies />

    <build>
        <pluginManagement>
            <plugins>

                <!-- Core plugins -->

                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${version.plugin.maven-clean-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.plugin.maven-compiler-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.plugin.maven-deploy-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${version.plugin.maven-install-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.plugin.maven-resources-plugin}</version>
                    <dependencies>
                        <dependency>
                            <!-- Fix org.ops4j:master:4.3.0 -->
                            <groupId>org.apache.maven.shared</groupId>
                            <artifactId>maven-filtering</artifactId>
                            <version>${version.org.apache.maven.shared.filtering}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${version.plugin.maven-site-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.plugin.maven-surefire-plugin}</version>
                </plugin>

                <!-- Packaging types/tools -->

                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.plugin.maven-jar-plugin}</version>
                </plugin>

                <!-- Reporting plugins -->

                <plugin>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.plugin.maven-checkstyle-plugin}</version>
                </plugin>

                <!-- Tools -->

                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${version.plugin.maven-enforcer-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <version>${version.plugin.maven-invoker-plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${version.plugin.maven-plugin-plugin}</version>
                </plugin>

                <!-- Sonatype -->

                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>${version.plugin.sonatype.nexus-staging-maven-plugin}</version>
                </plugin>

                <!-- Codehaus / Mojohaus -->

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${version.plugin.mojo.build-helper-maven-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.plexus</groupId>
                    <artifactId>plexus-component-metadata</artifactId>
                    <version>${version.plugin.codehaus.plexus-component-metadata}</version>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>

            <!-- Core plugins -->

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <!-- Tools -->

            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.commonjava.maven.enforcer</groupId>
                        <artifactId>enforce-managed-deps-rule</artifactId>
                        <version>${version.org.commonjava.maven.enforcer}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <banDuplicatePomDependencyVersions />
                                <reactorModuleConvergence />
                                <requirePluginVersions>
                                    <banLatest />
                                    <banRelease />
                                </requirePluginVersions>
                                <requireMavenVersion>
                                    <version>[3.5,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>[1.8,)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- Checkstyle: `mvn -Pcs validate` -->
        <profile>
            <id>cs</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>verify-style</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <configLocation>ops4j-tools-checks.xml</configLocation>
                                    <includes>org/ops4j/tools/**/*.java</includes>
                                    <encoding>UTF-8</encoding>
                                    <consoleOutput>true</consoleOutput>
                                    <failsOnError>true</failsOnError>
                                    <failOnViolation>true</failOnViolation>
                                    <logViolationsToConsole>true</logViolationsToConsole>
                                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                                    <violationSeverity>warning</violationSeverity>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>com.puppycrawl.tools</groupId>
                                <artifactId>checkstyle</artifactId>
                                <version>${version.com.puppycrawl.tools.checkstyle}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- License generation: `mvn -Plicense process-sources` -->
        <profile>
            <id>license</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <version>${version.plugin.mycila.license-maven-plugin}</version>
                        <configuration>
                            <aggregate>true</aggregate>
                            <useDefaultExcludes>true</useDefaultExcludes>
                            <header>license-header.txt</header>
                            <includes>
                                <include>src/main/java/**/*.java</include>
                                <include>src/test/java/**/*.java</include>
                                <include>**/*.xml</include>
                                <include>**/*.bnd</include>
                                <include>**/*.cfg</include>
                                <include>**/*.properties</include>
                            </includes>
                            <excludes />
                            <mapping>
                                <bnd>SCRIPT_STYLE</bnd>
                            </mapping>
                            <headerDefinitions>
                                <headerDefinition>license-headers.xml</headerDefinition>
                            </headerDefinitions>
                        </configuration>
                        <executions>
                            <execution>
                                <id>license-format</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>license-check</id>
                                <!-- This is the phase this plugin runs by default. Just an explicit information -->
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
