<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
-->
<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>

    <groupId>org.codice.countrycode</groupId>
    <artifactId>country-code</artifactId>
    <version>0.2.3</version>

    <name>Country Code</name>
    <packaging>pom</packaging>

    <properties>
        <snapshots.repository.url />
        <reports.repository.url />

        <!-- Plugin Properties -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.report.output.directory>project-info</project.report.output.directory>

        <!-- Dependency Properties -->
        <org.slf4j.version>1.7.25</org.slf4j.version>
        <ddf.version>2.11.3</ddf.version>
        <ddf.support.version>2.3.12</ddf.support.version>
        <guava.version>33.4.0-jre</guava.version>
        <apache.commons.io.version>2.19.0</apache.commons.io.version>
        <apache.commons.collections.version>4.4</apache.commons.collections.version>
        <apache.commons.lang3.version>3.18.0</apache.commons.lang3.version>
        <junit.version>4.13.2</junit.version>
        <gson.version>2.11.0</gson.version>
        <jaxb.version>4.0.5</jaxb.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Logging Dependencies -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${org.slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${org.slf4j.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ddf.lib</groupId>
            <artifactId>spock-shaded</artifactId>
            <version>${ddf.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.17</version>
                    <dependencies>
                        <dependency>
                            <groupId>ddf.support</groupId>
                            <artifactId>support-checkstyle</artifactId>
                            <version>${ddf.support.version}</version>
                            <optional>true</optional>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>checkstyle-check</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <!-- This configures the plugin for mvn install -->
                                <configLocation>checkstyle-enforced.xml</configLocation>
                                <headerLocation>lpgl-header-check.txt</headerLocation>
                                <sourceDirectory>${basedir}</sourceDirectory>
                                <includes>src/**/*.java</includes>
                                <consoleOutput>true</consoleOutput>
                                <failsOnError>true</failsOnError>
                            </configuration>
                        </execution>
                        <execution>
                            <id>checkstyle-check-xml</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <!-- This configures the plugin for mvn install -->
                                <configLocation>checkstyle-enforced-xml.xml</configLocation>
                                <headerLocation>lpgl-header-check-xml.txt</headerLocation>
                                <sourceDirectory>${basedir}</sourceDirectory>
                                <includes>src/**/*.xml, pom.xml</includes>
                                <consoleOutput>true</consoleOutput>
                                <failsOnError>true</failsOnError>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <!-- This configures the plugin for mvn checkstyle:checkstyle  -->
                        <configLocation>checkstyle-enforced.xml</configLocation>
                        <headerLocation>lpgl-header-check.txt</headerLocation>
                        <sourceDirectory>${basedir}</sourceDirectory>
                        <includes>src/**/*.java</includes>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <linkXRef>false</linkXRef>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <preparationGoals>clean install</preparationGoals>
                        <pushChanges>false</pushChanges>
                        <useReleaseProfile>false</useReleaseProfile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.0</version>
                    <executions>
                        <execution>
                            <id>default-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <maxmem>512M</maxmem>
                        <fork>${compiler.fork}</fork>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>4.2.0</version>
                    <extensions>true</extensions>
                    <configuration>
                        <!-- Disabled OBR to increase build speed -->
                        <obrRepository>NONE</obrRepository>
                        <instructions>
                            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        </instructions>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <!--  We don't want to inherit this *change* to the plugin configuration. -->
                <!--  Submodules will still inherit the plugin and the configuration from pluginManagement -->
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <!-- Match the execution defined in the pluginManagement and override it-->
                        <!-- Prev check here. -->
                        <id>checkstyle-check</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>checkstyle-check-xml</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- The gmavenplus plugin is used to compile Groovy code. -->
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <argLine>${argLine} -Djava.awt.headless=true -noverify</argLine>
                    <includes>
                        <include>**/*Spec.class</include>
                        <include>**/*Test.class</include>
                        <include>**/Test*.class</include>
                        <include>**/*TestCase.class</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.coveo</groupId>
                <artifactId>fmt-maven-plugin</artifactId>
                <version>2.3.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>staticAnalysis</id>
            <activation>
                <property>
                    <name>skipStatic</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>default-prepare-agent</id>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>default-report</id>
                                    <phase>prepare-package</phase>
                                    <configuration>
                                        <outputDirectory>
                                            ${project.build.directory}/site/${project.report.output.directory}/jacoco/
                                        </outputDirectory>
                                    </configuration>
                                    <goals>
                                        <goal>report</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>default-check</id>
                                    <goals>
                                        <goal>check</goal>
                                    </goals>
                                    <configuration>
                                        <haltOnFailure>true</haltOnFailure>
                                        <rules>
                                            <rule>
                                                <element>BUNDLE</element>
                                                <!--
                                                When overriding the limits in child pom files make sure
                                                to override all three limits. Limits that are excluded
                                                will be set to 0 not 0.75
                                                -->
                                                <limits>
                                                    <limit>
                                                        <counter>INSTRUCTION</counter>
                                                        <value>COVEREDRATIO</value>
                                                        <minimum>0.75</minimum>
                                                    </limit>
                                                    <limit>
                                                        <counter>BRANCH</counter>
                                                        <value>COVEREDRATIO</value>
                                                        <minimum>0.75</minimum>
                                                    </limit>
                                                    <limit>
                                                        <counter>COMPLEXITY</counter>
                                                        <value>COVEREDRATIO</value>
                                                        <minimum>0.75</minimum>
                                                    </limit>
                                                </limits>
                                            </rule>
                                        </rules>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>codice</id>
            <name>Codice Repository</name>
            <url>https://artifacts.codice.org/content/groups/public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>codice</id>
            <name>Codice Repository</name>
            <url>https://artifacts.codice.org/content/groups/public/</url>
        </pluginRepository>
    </pluginRepositories>

    <scm>
        <url>https://github.com/codice/countrycode.git</url>
        <connection>scm:git:git@github.com:codice/countrycode.git</connection>
        <developerConnection>scm:git:git@github.com:codice/countrycode.git</developerConnection>
        <tag>codice/countrycode-0.2.3</tag>
    </scm>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>${releases.repository.url}</url>
        </repository>
    </distributionManagement>

    <modules>
        <module>api</module>
        <module>converter</module>
        <module>standards</module>
        <module>converter-api</module>
    </modules>
</project>
