<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>plugins</artifactId>
    <groupId>org.apache.archiva</groupId>
    <version>1.4.0-SNAPSHOT</version>
  </parent>
  <artifactId>metadata-store-cassandra</artifactId>
  <packaging>bundle</packaging>
  <name>Archiva Core Plugins :: Cassandra JPA Storage for Metadata</name>

  <properties>
    <cassandraVersion>1.2.5</cassandraVersion>
  </properties>

  <dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>metadata-repository-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>metadata-repository-api</artifactId>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.archiva</groupId>
      <artifactId>archiva-test-utils</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-simple</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>net.sf.beanlib</groupId>
      <artifactId>beanlib</artifactId>
      <exclusions>
        <exclusion>
          <groupId>cglib</groupId>
          <artifactId>cglib</artifactId>
        </exclusion>
        <exclusion>
          <groupId>aopalliance</groupId>
          <artifactId>aopalliance</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jpa_2.0_spec</artifactId>
    </dependency>

    <dependency>
      <groupId>com.netflix.astyanax</groupId>
      <artifactId>astyanax-entity-mapper</artifactId>
      <version>1.56.37</version>
      <exclusions>
        <exclusion>
          <groupId>stax</groupId>
          <artifactId>stax-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.cassandra</groupId>
          <artifactId>cassandra-thrift</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.persistence</groupId>
          <artifactId>persistence-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.netflix.astyanax</groupId>
      <artifactId>astyanax-core</artifactId>
      <version>1.56.37</version>
    </dependency>

    <dependency>
      <groupId>com.netflix.astyanax</groupId>
      <artifactId>astyanax-thrift</artifactId>
      <version>1.56.37</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.cassandra</groupId>
          <artifactId>cassandra-thrift</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.cassandra</groupId>
      <artifactId>cassandra-all</artifactId>
      <version>${cassandraVersion}</version>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>


    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easytesting</groupId>
      <artifactId>fest-assert-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-1.2-api</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.lmax</groupId>
      <artifactId>disruptor</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>
  <build>
    <testResources>
      <testResource>
        <directory>src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>org.apache.archiva.metadata.repository.cassandra</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Export-Package>
              org.apache.archiva.metadata.repository.cassandra;version=${project.version};-split-package:=merge-first
            </Export-Package>
            <Import-Package>
                javax.annotation,
                javax.inject,
                javax.persistence,
                com.google.common.base,
                com.google.common.collect,
                com.netflix.astyanax,
                com.netflix.astyanax.connectionpool,
                com.netflix.astyanax.connectionpool.exceptions,
                com.netflix.astyanax.connectionpool.impl,
                com.netflix.astyanax.entitystore,
                com.netflix.astyanax.impl,
                com.netflix.astyanax.thrift,
                net.sf.beanlib.provider.replicator,
                org.apache.archiva.metadata.model;version=${project.version},
                org.apache.archiva.metadata.repository;version=${project.version},
                org.apache.archiva.configuration,
                org.apache.commons.lang;version="[2.4,3)",
                org.slf4j;resolution:=optional,
                org.springframework.context,
                org.springframework.stereotype
            </Import-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>reserve-ports</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <configuration>
              <portNames>
                <portName>cassandraPort</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- TODO use dynamic port -->

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cassandra-maven-plugin</artifactId>
        <version>1.2.5-1-SNAPSHOT</version>
        <executions>
          <execution>
            <id>start-cassandra</id>
            <phase>test-compile</phase>
            <goals>
              <goal>start</goal>
            </goals>
            <configuration>
              <rpcPort>${cassandraPort}</rpcPort>
              <addMainClasspath>false</addMainClasspath>
              <addTestClasspath>false</addTestClasspath>
            </configuration>
          </execution>
          <execution>
            <id>stop-cassandra</id>
            <phase>test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <systemPropertyVariables>
              <cassandraPort>${cassandraPort}</cassandraPort>
            </systemPropertyVariables>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>