<?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-dependencies</artifactId>
        <version>2.0.0-rc9</version>
        <relativePath>../dropwizard-dependencies</relativePath>
    </parent>

    <artifactId>dropwizard-parent</artifactId>
    <packaging>pom</packaging>

    <name>Dropwizard Parent</name>
    <description>
        Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web
        applications.
    </description>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.showWarnings>true</maven.compiler.showWarnings>
        <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
        <maven.compiler.optimize>false</maven.compiler.optimize>
        <maven.compiler.forceJavacCompilerUse>true</maven.compiler.forceJavacCompilerUse>

        <argLine>-Duser.language=en -Duser.region=US</argLine>
    </properties>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <maven.compiler.optimize>true</maven.compiler.optimize>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <doclint>none</doclint>
                            <quiet>true</quiet>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <maven.source.skip>true</maven.source.skip>
                <pgpverify.skip>true</pgpverify.skip>
                <jacoco.skip>true</jacoco.skip>
            </properties>
            <build>
                <plugins>
                    <!-- Run tests in parallel in the dev mode-->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <parallel>classes</parallel>
                            <threadCount>2</threadCount>
                            <perCoreThreadCount>true</perCoreThreadCount>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>compile-eclipse</id>
            <activation>
                <jdk>1.8</jdk>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <debug>true</debug>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.simplify4u.plugins</groupId>
                                            <artifactId>pgpverify-maven-plugin</artifactId>
                                            <version>${pgpverify-maven-plugin.version}</version>
                                            <goals>
                                                <goal>check</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore />
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>compile-not-eclipse</id>
            <activation>
                <jdk>1.8</jdk>
                <property>
                    <name>!m2e.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <debug>true</debug>
                            <compilerId>javac-with-errorprone</compilerId>
                            <fork>true</fork>
                            <annotationProcessorPaths>
                                <!-- enable extended nullability checks -->
                                <path>
                                    <groupId>com.uber.nullaway</groupId>
                                    <artifactId>nullaway</artifactId>
                                    <version>${nullaway.version}</version>
                                </path>
                            </annotationProcessorPaths>
                            <compilerArgs>
                                <arg>-XepDisableWarningsInGeneratedCode</arg>
                                <!-- Disable EqualsGetClass. Further discussion: https://github.com/dropwizard/dropwizard/pull/2647 -->
                                <arg>-Xep:EqualsGetClass:OFF</arg>
                                <arg>-Xep:NullAway:ERROR</arg>
                                <arg>-XepOpt:NullAway:AnnotatedPackages=io.dropwizard</arg>
                                <arg>-XepOpt:NullAway:ExcludedFieldAnnotations=org.mockito.Mock</arg>
                                <arg>-XepOpt:NullAway:UnannotatedSubPackages=io.dropwizard.benchmarks</arg>
                            </compilerArgs>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.codehaus.plexus</groupId>
                                <artifactId>plexus-compiler-javac-errorprone</artifactId>
                                <version>${plexus-compiler-javac-errorprone.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.google.errorprone</groupId>
                                <artifactId>error_prone_core</artifactId>
                                <version>${error_prone.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.dropwizard</groupId>
                <artifactId>dropwizard-dependencies</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <DependencyConvergence />
                                <bannedDependencies>
                                    <excludes>
                                        <!-- This should not exist as it will force SLF4J calls to be delegated to log4j -->
                                        <exclude>org.slf4j:slf4j-log4j12</exclude>
                                        <!-- This should not exist as it will force SLF4J calls to be delegated to jul -->
                                        <exclude>org.slf4j:slf4j-jdk14</exclude>
                                        <!-- Ensure only the slf4j binding for logback is on the classpath -->
                                        <exclude>log4j:log4j</exclude>
                                        <!-- As recommended from the slf4j guide, exclude commons-logging -->
                                        <exclude>commons-logging:commons-logging</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.simplify4u.plugins</groupId>
                <artifactId>pgpverify-maven-plugin</artifactId>
                <configuration>
                    <quiet>true</quiet>
                    <pgpKeyServer>hkps://keyserver.ubuntu.com</pgpKeyServer>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <doclint>none</doclint>
                    <quiet>true</quiet>
                </configuration>
                <reportSets>
                    <reportSet>
                        <id>html</id>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
</project>
