<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>
    <groupId>com.washingtonpost</groupId>
    <artifactId>wp-oss-parent-pom</artifactId>
    <packaging>pom</packaging>
    <version>0.0.3</version>
    <name>wp-oss-parent-pom</name>
    <description>Washington Post Master Public Parent POM</description>
    <url>https://washingtonpost.com/</url>

    <licenses>
        <license>
            <name>The MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Washington Post Engineering</name>
            <email>web.engineering@washpost.com</email>
            <organization>The Washington Post</organization>
        </developer>
    </developers>
    
    <scm>
        <connection>scm:git:git@github.com:washingtonpost/wp-oss-parent-pom.git</connection>
        <developerConnection>scm:git:git@github.com:washingtonpost/wp-oss-parent-pom.git</developerConnection>
        <tag>0.0.3</tag>
        <url>https://github.com/washingtonpost/wp-oss-parent-pom.git</url>
    </scm>
    
    <!-- FIXME Try commenting this out and seeing if the release can work with just the profile activating the servers from settings.xml -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh-releases</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
    
    <properties>
        <default.encoding>UTF-8</default.encoding>
        <project.build.sourceEncoding>${default.encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${default.encoding}</project.reporting.outputEncoding>
        <maven.failsafe.argLine>-XX:+HeapDumpOnOutOfMemoryError -Xmx1024M -XX:MaxPermSize=256M -Djava.awt.headless=true</maven.failsafe.argLine>
        <maven.surefire.argLine>-XX:+HeapDumpOnOutOfMemoryError -Xmx1024M -XX:MaxPermSize=256M -Djava.awt.headless=true</maven.surefire.argLine>
        <maven.surefire.fork.count>1C</maven.surefire.fork.count>
        <maven.test.runOrder>hourly</maven.test.runOrder>
        <version.java>1.8</version.java>
        <version.maven.checkstyle.plugin>2.15</version.maven.checkstyle.plugin>
        <version.maven.clean.plugin>2.4.1</version.maven.clean.plugin>
        <version.maven.compiler.plugin>3.1</version.maven.compiler.plugin>
        <version.maven.deploy.plugin>2.8.1</version.maven.deploy.plugin>
        <version.maven.enforcer.plugin>1.3</version.maven.enforcer.plugin>
        <version.maven.exec.plugin>1.2</version.maven.exec.plugin>
        <version.maven.findbugs.plugin>2.4.0</version.maven.findbugs.plugin>
        <version.maven.gpg.plugin>1.5</version.maven.gpg.plugin>
        <version.maven.jacoco.plugin>0.7.0.201403182114</version.maven.jacoco.plugin>
        <version.maven.jar.plugin>2.3.2</version.maven.jar.plugin>
        <version.maven.javadoc.plugin>2.9.1</version.maven.javadoc.plugin>
        <version.maven.jxr.plugin>2.3</version.maven.jxr.plugin>
        <version.maven.pmd.plugin>2.7.1</version.maven.pmd.plugin>
        <version.maven.project.info.plugin>2.7</version.maven.project.info.plugin>
        <version.maven.release.plugin>2.5.2</version.maven.release.plugin>
        <version.maven.resources.plugin>2.6</version.maven.resources.plugin>
        <version.maven.shade.plugin>2.2</version.maven.shade.plugin>
        <version.maven.site.plugin>3.3</version.maven.site.plugin>
        <version.maven.source.plugin>2.2.1</version.maven.source.plugin>
        <version.maven.surefire.plugin>2.16</version.maven.surefire.plugin>
        <version.nexus.staging.plugin>1.6.3</version.nexus.staging.plugin>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${version.maven.release.plugin}</version>
                    <configuration combine.self="override">
                        <!-- The '@' is not a typo; it's this plugin's delimiter -->
                        <!-- See http://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html -->
                        <tagNameFormat>@{project.version}</tagNameFormat>
                        <goals>deploy</goals>
                        <indentSize>${release.plugin.indent.size}</indentSize>
                        <!-- Invoke 'release' profile which skips tests -->
                        <releaseProfiles>release</releaseProfiles>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.maven.surefire.plugin}</version>
                    <configuration>
                        <argLine>${jacocoSurefireArgLine} ${maven.surefire.argLine}</argLine>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <!-- Defines the order the tests will be run in. Supported values are "alphabetical",
                        "reversealphabetical", "random", "hourly" (alphabetical on even hours, reverse alphabetical
                        on odd hours) and "filesystem". -->
                        <runOrder>${maven.test.runOrder}</runOrder>
                        <systemPropertyVariables>
                            <basedir>${project.basedir}</basedir>
                            <build.directory>${project.build.directory}</build.directory>
                        </systemPropertyVariables>
                        <!-- Spawn 1 VM per core to run unit tests in parallel -->
                        <forkCount>${maven.surefire.fork.count}</forkCount>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.maven.surefire.plugin}</version>  <!-- intentionally set to version.maven.surefire.plugin -->
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <!-- This fails the build if an IntTest fails -->
                            <id>verify</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <argLine>${jacocoFailsafeArgLine} ${maven.failsafe.argLine}</argLine>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <!-- Defines the order the tests will be run in. Supported values are "alphabetical",
                        "reversealphabetical", "random", "hourly" (alphabetical on even hours, reverse alphabetical
                        on odd hours) and "filesystem". -->
                        <runOrder>${maven.test.runOrder}</runOrder>
                        <systemPropertyVariables>
                            <basedir>${project.basedir}</basedir>
                            <build.directory>${project.build.directory}</build.directory>
                        </systemPropertyVariables>
                        <includes>
                            <include>**/IntTest*.java</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${version.maven.clean.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.maven.checkstyle.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.maven.compiler.plugin}</version>
                    <configuration>
                        <source>${version.java}</source>
                        <target>${version.java}</target>
                        <compilerArgument>-Xlint:unchecked</compilerArgument>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.maven.jar.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.maven.javadoc.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.maven.deploy.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${version.maven.enforcer.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${version.maven.shade.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.maven.source.plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${version.maven.site.plugin}</version>
                    <configuration>
                        <locales>en</locales>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${version.maven.pmd.plugin}</version>
                    <configuration>
                        <targetJdk>${version.java}</targetJdk>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.maven.resources.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${version.maven.exec.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${version.maven.jacoco.plugin}</version>
                    <executions>
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${jacoco.datafile.location}</destFile>
                                <!-- Sets the name of the property containing the settings for JaCoCo runtime agent. -->
                                <propertyName>jacocoSurefireArgLine</propertyName>
                                <append>true</append>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-unit-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${jacoco.datafile.location}</dataFile>
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-unit-tests</outputDirectory>
                                <append>true</append>
                            </configuration>
                        </execution>
                        <execution>
                            <id>pre-integration-test</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${jacoco.datafile.location}</destFile>
                                <!-- Sets the name of the property containing the settings for JaCoCo runtime agent. -->
                                <propertyName>jacocoFailsafeArgLine</propertyName>
                                <append>true</append>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-integration-test</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${jacoco.datafile.location}</dataFile>
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-combined</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-no-snapshots</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireReleaseDeps>
                                    <message>No Snapshots Allowed!</message>
                                    <onlyWhenRelease>true</onlyWhenRelease>
                                </requireReleaseDeps>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
    <profiles>
        <profile>
            <!--
            Used only when invoking release:perform so we do not re-run tests as part of the deployment
            -->
            <id>release</id>
            <properties>
                <maven.test.skip.exec>true</maven.test.skip.exec>
                <jetty.skip>true</jetty.skip>
            </properties>
        </profile>
        <profile>
            <!--
            Used to configure our maven-release-plugin like Sonatype wants for releasing our opensource artifacts
            -->
            <id>release-opensource</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>${version.maven.release.plugin}</version>
                        <configuration combine.self="override">
                            <mavenExecutorId>forked-path</mavenExecutorId>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release-opensource</releaseProfiles>
                            <tagNameFormat>@{project.version}</tagNameFormat>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${version.maven.gpg.plugin}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${version.nexus.staging.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh-releases</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
