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

    <name>Dropbox Core API SDK</name>
    <description>A client library for Dropbox's HTTP-based "Core API".</description>

    <groupId>com.dropbox.core</groupId>
    <artifactId>dropbox-core-sdk</artifactId>
    <version>1.8</version>

    <packaging>jar</packaging>

    <url>https://www.dropbox.com/developers/core</url>
    <scm>
        <connection>scm:git:git@github.com:dropbox/dropbox-sdk-java.git</connection>
        <developerConnection>scm:git:git@github.com:dropbox/dropbox-sdk-java.git</developerConnection>
        <url>https://github.com/dropbox/dropbox-sdk-java</url>
    </scm>

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

    <developers>
        <developer>
            <id>dropbox-api-team</id>
            <name>Dropbox API Team</name>
            <email>api-support@dropbox.com</email>
            <organization>Dropbox</organization>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>true</skipTests>
        <osgi.bnd.noee>false</osgi.bnd.noee>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>[2.2,2.7)</version>
        </dependency>

        <!-- A "soft" dependency on the Servlet API. -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>

        <!-- A "soft" dependency on OkHttp. -->
        <dependency>
            <groupId>com.squareup.okhttp</groupId>
            <artifactId>okhttp</artifactId>
            <version>2.5.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>[6,7)</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.caliper</groupId>
            <artifactId>caliper</artifactId>
            <version>1.0-beta-1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>${project.build.sourceDirectory}</directory>
                <includes>
                    <include>com/dropbox/core/sdk-version.txt</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources/certs</directory>
            </resource>
        </resources>
        <testSourceDirectory>test</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>test</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>6</source>
                    <target>6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>1.11</version>
                <configuration>
                    <signature>
                        <groupId>org.codehaus.mojo.signature</groupId>
                        <artifactId>java16</artifactId>
                        <version>1.0</version>
                    </signature>
                </configuration>
                <executions>
                    <execution>
                        <id>check-java-version-compatibility</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <quiet>true</quiet>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <copy file="pom.xml" tofile="${project.build.directory}/${project.build.finalName}.pom" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.15</version>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.dropbox.maven</groupId>
                <artifactId>pem-converter-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <configuration>
                            <input>src/com/dropbox/core/http/trusted-certs.crt</input>
                            <output>${project.build.directory}/generated-resources/certs/com/dropbox/core/http/trusted-certs.raw</output>
                        </configuration>
                        <goals>
                            <goal>convert</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Add OSGi metadata to JAR manifest. -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <_noee>${osgi.bnd.noee}</_noee>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Checker Framework -->
            <plugin>
                <groupId>edu.washington.cs.types.checker</groupId>
                <artifactId>checker-maven-plugin</artifactId>
                <version>1.7.5</version>
                <configuration>
                    <processors>
                        <processor>checkers.nullness.NullnessChecker</processor>
                    </processors>
                    <!--
                        "-AassumeSideEffectFree"
                            This is unsound, but makes it easier to get started.
                        "-AsuppressWarnings=purity.invalid.overriding"
                            Purity warnings are noisy right now, so disable them.
                        TODO:
                            Add "-AinvariantArrays" when it's fixed: https://code.google.com/p/checker-framework/issues/detail?id=299
                    -->
                    <javacParams>-AstubWarnIfNotFound -Astubs=support/checker-framework-stubs -AassumeSideEffectFree -AsuppressWarnings=purity.invalid.overriding -AprintErrorStack</javacParams>
                </configuration>
            </plugin>

            <!-- FindBugs -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <effort>max</effort>
                    <threshold>low</threshold>
                    <xmlOutput>true</xmlOutput>
                    <excludeFilterFile>support/findbugs-exclude.xml</excludeFilterFile>
                </configuration>
            </plugin>

            <!-- Write test classpath to a file. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <outputFile>${project.build.directory}/test-classpath</outputFile>
                    <includeScope>test</includeScope>
                </configuration>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>build-classpath</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <build>
                <plugins>
                    <!--
                        JDK 8's javadoc has an on-by-default lint called "missing", which requires
                        that everything be documented.  Disable this lint, because we intentionally
                        don't document some things (e.g. if it's obvious).
                    -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <!--
                                TODO: We want to pass a single arg: "-Xdoclint:all,-missing", but
                                maven-javadoc-plugin is broken (https://jira.codehaus.org/browse/MJAVADOC-368).
                                As a workaround just list all the lints explicitly.
                            -->
                            <additionalparam>
                                -Xdoclint:accessibility
                                -Xdoclint:html
                                -Xdoclint:reference
                                -Xdoclint:syntax
                            </additionalparam>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
