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

    <!-- Quickstart & Common Reference:

     - run all tests (unit & int): mvn test
     - run only unit tests: mvn test -Dunit
     - compile and build: mvn package
     - build and install into ~/.m2: mvn install
     - skip tests on install or package add -Dmaven.test.skip
     - stage & close (but not release) on maven central: mvn clean deploy
       note that -SNAPSHOT is not allowed on deploy

    -->

    <groupId>com.couchbase.client</groupId>
    <artifactId>java-client</artifactId>
    <version>2.3.6</version>
    <packaging>jar</packaging>

    <name>Couchbase Java SDK</name>
    <description>The official Couchbase Java SDK</description>
    <url>http://couchbase.com</url>

    <properties>
        <java-compat.version>1.6</java-compat.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <core.version>1.3.6</core.version>
        <junit.version>4.12</junit.version>
        <mockito.version>1.10.19</mockito.version>
        <slf4j.version>1.7.7</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <commons-logging.version>1.1.3</commons-logging.version>
        <assertj.version>1.7.1</assertj.version>
        <guavatest.version>19.0</guavatest.version>
        <core.apidocs>${project.build.directory}/coredocs</core.apidocs>
    </properties>

    <organization>
        <name>Couchbase, Inc.</name>
        <url>http://couchbase.com</url>
    </organization>

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

    <scm>
        <url>https://github.com/couchbase/couchbase-java-client</url>
        <connection>
            scm:git:git://github.com/couchbase/couchbase-java-client
        </connection>
        <developerConnection>
            scm:git:git://github.com/couchbase/couchbase-java-client
        </developerConnection>
    </scm>

    <issueManagement>
        <system>Couchbase JIRA</system>
        <url>http://www.couchbase.com/issues/browse/JCBC</url>
    </issueManagement>

    <developers>
        <developer>
            <id>daschl</id>
            <name>Michael Nitschinger</name>
            <email>michael.nitschinger@couchbase.com</email>
        </developer>
        <developer>
            <id>simonbasle</id>
            <name>Simon Baslé</name>
            <email>simon@couchbase.com</email>
        </developer>
        <developer>
            <id>avsej</id>
            <name>Sergey Avseyev</name>
            <email>sergey@couchbase.com</email>
        </developer>
    </developers>

    <dependencies>
        <!-- Exposed, Required Dependencies -->
        <dependency>
            <groupId>com.couchbase.client</groupId>
            <artifactId>core-io</artifactId>
            <version>${core.version}</version>
        </dependency>

        <!-- Exposed, Optional Dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons-logging.version}</version>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>eu.codearte.catch-exception</groupId>
            <artifactId>catch-exception</artifactId>
            <version>1.4.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava-testlib</artifactId>
            <version>${guavatest.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <!-- this execution unpacks the core-io javadocs jar into
                        the build directory for later reuse in offline linking of the
                        java-client javadoc
                        -->
                        <id>unpack-core-docs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.couchbase.client</groupId>
                                    <artifactId>core-io</artifactId>
                                    <version>${core.version}</version>
                                    <type>jar</type>
                                    <classifier>javadoc</classifier>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${core.apidocs}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <links>
                        <link>http://reactivex.io/RxJava/javadoc/</link>
                    </links>
                    <offlineLinks>
                        <offlineLink>
                            <!--link the core api docs in a offline manner since they won't have been published yet-->
                            <url>http://docs.couchbase.com/sdk-api/couchbase-core-io-${core.version}/</url>
                            <!--the javadoc build process will rely on the locally unpack core-io javadoc jar-->
                            <location>${core.apidocs}/</location>
                        </offlineLink>
                    </offlineLinks>
                    <doclet>ch.raffael.doclets.pegdown.PegdownDoclet</doclet>
                    <docletArtifact>
                        <groupId>ch.raffael.pegdown-doclet</groupId>
                        <artifactId>pegdown-doclet</artifactId>
                        <version>1.1</version>
                    </docletArtifact>
                    <useStandardDocletOptions>true</useStandardDocletOptions>
                    <windowtitle>Couchbase Java SDK</windowtitle>
                    <doctitle>Couchbase Java SDK (${project.version})</doctitle>
                    <bottom><![CDATA[Copyright &copy; 2015 Couchbase, Inc.]]></bottom>
                    <overview>docs/teaser.html</overview>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>${java-compat.version}</source>
                    <target>${java-compat.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.3</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9.1</version>
                <executions>
                    <execution>
                        <id>add-integration-test-source-as-test-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <!-- add the following sources in addition to the unit tests -->
                                <source>${test-source-directory}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>1.14</version>
                <configuration>
                    <signature>
                        <groupId>org.codehaus.mojo.signature</groupId>
                        <artifactId>java16</artifactId>
                        <version>1.0</version>
                    </signature>
                </configuration>
                <executions>
                    <execution>
                        <id>ensure-java-1.6-class-library</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- by default, add also the int tests -->
                <test-source-directory>src/integration/java</test-source-directory>
            </properties>
        </profile>
        <profile>
            <id>unit</id>
            <activation>
                <property>
                    <name>unit</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <!-- just adding the unit tests again, noop. -->
                <test-source-directory>src/test/java</test-source-directory>
            </properties>
        </profile>
    </profiles>

</project>
