<!--

         Copyright (C) 2012-2015 DataStax Inc.

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

-->
<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>
    <parent>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-parent</artifactId>
        <version>3.0.0</version>
    </parent>
    <artifactId>cassandra-driver-core</artifactId>
    <packaging>bundle</packaging>
    <name>DataStax Java Driver for Apache Cassandra - Core</name>
    <description>A driver for Apache Cassandra 1.2+ that works exclusively with the Cassandra Query Language version 3
        (CQL3) and Cassandra's binary protocol.
    </description>
    <url>https://github.com/datastax/java-driver</url>

    <properties>
        <main.basedir>${project.parent.basedir}</main.basedir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-handler</artifactId>
            <version>${netty.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>

        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <version>${metrics.version}</version>
        </dependency>

        <!-- Compression libraries for the protocol. -->
        <!-- Each of them is only a mandatory runtime dependency if you want to use the compression it offers -->

        <dependency>
            <groupId>org.xerial.snappy</groupId>
            <artifactId>snappy-java</artifactId>
            <version>${snappy.version}</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>net.jpountz.lz4</groupId>
            <artifactId>lz4</artifactId>
            <version>${lz4.version}</version>
            <optional>true</optional>
        </dependency>

        <!-- End of compression libraries -->

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-epoll</artifactId>
            <version>${netty.version}</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.hdrhistogram</groupId>
            <artifactId>HdrHistogram</artifactId>
            <version>${hdr.version}</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.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>org.scassandra</groupId>
            <artifactId>java-client</artifactId>
            <version>${scassandra.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>${commons-exec.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative</artifactId>
            <version>1.1.33.Fork10</version>
            <classifier>${os.detected.classifier}</classifier>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <version>2.4.0</version>
                <!--
                  Default configuration, used by the `bundle` goal that is implicitly bound to the `package` phase
                  (because the project uses the `bundle` packaging)
                -->
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>com.datastax.driver.core</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <_include>-osgi.bnd</_include>
                        <Import-Package><![CDATA[com.google.common*;version="[16.0.1,19)",*]]></Import-Package>
                    </instructions>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>pom</supportedProjectType>
                    </supportedProjectTypes>
                </configuration>
                <executions>
                    <!-- Alternate execution to generate the shaded JAR's manifest -->
                    <execution>
                        <id>bundle-manifest-shaded</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                        <configuration>
                            <manifestLocation>${project.build.directory}/META-INF-shaded</manifestLocation>
                            <instructions>
                                <Import-Package>
                                    <![CDATA[com.google.common.*;version="[16.0.1,19)",!io.netty.*,*]]></Import-Package>
                                <Private-Package>com.datastax.shaded.*</Private-Package>
                            </instructions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <artifactSet>
                                <includes>
                                    <include>io.netty:*</include>
                                </includes>
                                <excludes>
                                    <exclude>io.netty:netty-transport-native-epoll</exclude>
                                </excludes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>io.netty</pattern>
                                    <shadedPattern>com.datastax.shaded.netty</shadedPattern>
                                </relocation>
                            </relocations>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                                    <resources>
                                        <resource>META-INF/MANIFEST.MF</resource>
                                        <resource>META-INF/io.netty.versions.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-buffer/pom.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-buffer/pom.xml</resource>
                                        <resource>META-INF/maven/io.netty/netty-codec/pom.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-codec/pom.xml</resource>
                                        <resource>META-INF/maven/io.netty/netty-common/pom.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-common/pom.xml</resource>
                                        <resource>META-INF/maven/io.netty/netty-handler/pom.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-handler/pom.xml</resource>
                                        <resource>META-INF/maven/io.netty/netty-transport/pom.properties</resource>
                                        <resource>META-INF/maven/io.netty/netty-transport/pom.xml</resource>
                                    </resources>
                                </transformer>
                                <!-- Pick up the alternate manifest that was generated by the alternate execution of the bundle plugin -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                                    <resource>META-INF/MANIFEST.MF</resource>
                                    <file>${project.build.directory}/META-INF-shaded/MANIFEST.MF</file>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-jar-plugin</artifactId>
                                        <versionRange>[2.2,)</versionRange>
                                        <goals>
                                            <goal>test-jar</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.4.1.Final</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>unit</id>
            <properties>
                <env>default</env>
            </properties>
            <!-- do not use activeByDefault as other profiles might be active -->
            <activation>
                <property>
                    <name>!activateUnitTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <groups>unit</groups>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                                <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60
                                </com.datastax.driver.NEW_NODE_DELAY_SECONDS>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                            <!--May be needed for debugging-->
                            <!--<forkMode>never</forkMode>-->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>short</id>
            <properties>
                <env>default</env>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <groups>unit,short</groups>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>isolated</id>
            <properties>
                <env>default</env>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <forkCount>1</forkCount>
                            <reuseForks>false</reuseForks>
                            <groups>isolated</groups>
                            <!-- Files containing tests to be included must be added here.
                                 this prevents a fork being created for each test class. -->
                            <includes>
                                <include>**/SSL*Test.java</include>
                            </includes>
                            <reportNameSuffix>isolated</reportNameSuffix>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>long</id>
            <properties>
                <env>default</env>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <groups>unit,short,long</groups>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>duration</id>
            <properties>
                <env>default</env>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <groups>unit,short,long,duration</groups>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>doc</id>
            <properties>
                <env>default</env>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.16</version>
                        <configuration>
                            <groups>unit,doc</groups>
                            <useFile>false</useFile>
                            <systemPropertyVariables>
                                <cassandra.version>${cassandra.version}</cassandra.version>
                                <ipprefix>${ipprefix}</ipprefix>
                            </systemPropertyVariables>
                            <classpathDependencyExcludes>
                                <classpathDependencyExcludes>io.netty:netty-transport-native-epoll
                                </classpathDependencyExcludes>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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

    <scm>
        <connection>scm:git:git@github.com:datastax/java-driver.git</connection>
        <developerConnection>scm:git:git@github.com:datastax/java-driver.git</developerConnection>
        <url>https://github.com/datastax/java-driver</url>
        <tag>3.0.0</tag>
    </scm>

    <developers>
        <developer>
            <name>Various</name>
            <organization>DataStax</organization>
        </developer>
    </developers>

</project>

