<?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/maven-v4_0_0.xsd">
  <parent>
    <groupId>io.hawt</groupId>
    <artifactId>project</artifactId>
    <version>1.4.0.redhat-630441</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>hawtio-default</artifactId>
  <packaging>war</packaging>
  <name>${project.artifactId}</name>
  <description>hawtio :: Default Web Application</description>

  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${servlet-api-version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-base</artifactId>
      <version>${project.version}</version>
      <!--
        NOTE this WAR dependency type which enables this WAR to
        inherit all the plugins and content from the core hawtio-base WAR
      -->
      <type>war</type>
    </dependency>

    <!-- lets mark dependencies from the WAR as provided to avoid jetty:run adding duplicates -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-git</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.aries.blueprint</groupId>
      <artifactId>org.apache.aries.blueprint.web</artifactId>
      <version>${blueprint-web-version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-servlet_2.5_spec</artifactId>
        </exclusion>
        <!-- ignore old versions -->
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- now lets add some components -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-maven-indexer</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-aether</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-kubernetes</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-json-schema-mbean</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-ide</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-local-jvm-mbean</artifactId>
      <version>${project.version}</version>
    </dependency>


    <!-- override old version of commons-codec / commons-logging -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>${commons-codec-version}</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>${commons-logging-version}</version>
    </dependency>
    <dependency>
      <groupId>io.fabric8.insight</groupId>
      <artifactId>insight-log4j</artifactId>
      <version>${insight-log4j-version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>

      <!-- exclude duplicate JARs which for some odd reason gets included -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>${war-plugin-version}</version>
        <configuration>
          <packagingExcludes>**/lib/commons-logging-1.0.3.jar,**/lib/httpclient-4.3.4.jar</packagingExcludes>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>

      <plugin>
        <groupId>${jetty-plugin-groupId}</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-version}</version>
        <configuration>
          <webAppSourceDirectory>${project.build.directory}/${project.name}</webAppSourceDirectory>
          <scanIntervalSeconds>1</scanIntervalSeconds>
          <webAppConfig>
            <contextPath>${context}</contextPath>
          </webAppConfig>
          <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
              <port>${jettyPort}</port>
              <maxIdleTime>60000</maxIdleTime>
            </connector>
          </connectors>
          <systemProperties>
            <systemProperty>
              <key>hawtio.config.dir</key>
              <value>${hawtio-config-dir}</value>
            </systemProperty>
            <systemProperty>
              <key>hawtio.config.repo</key>
              <value>${hawtio-config-repo}</value>
            </systemProperty>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.0</version>
        <configuration>
          <port>9090</port>
          <path>${context}</path>
          <systemProperties>
          </systemProperties>
          <useTestClasspath>false</useTestClasspath>
          <!--
                    <warSourceDirectory>${project.build.directory}/${project.name}-${project.version}</warSourceDirectory>
          -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat6-maven-plugin</artifactId>
        <version>2.0</version>
        <configuration>
          <port>9090</port>
          <path>${context}</path>
          <systemProperties>
          </systemProperties>
          <useTestClasspath>false</useTestClasspath>
          <!--
                    <warSourceDirectory>${project.build.directory}/${project.name}-${project.version}</warSourceDirectory>
          -->
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/overlays</directory>
              <includes>
                <include>**/*.*</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>kubernetes-api</id>
      <dependencies>
        <dependency>
          <groupId>io.fabric8</groupId>
          <artifactId>kubernetes-api</artifactId>
          <version>2.0.0-SNAPSHOT</version>
          <exclusions>
            <exclusion>
              <groupId>org.apache.karaf.features</groupId>
              <artifactId>org.apache.karaf.features.core</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.osgi</groupId>
              <artifactId>org.osgi.core</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
