<?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>2.16.2</version>
    <relativePath>../..</relativePath>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>hawtio-osgi</artifactId>
  <packaging>war</packaging>
  <name>${project.artifactId}</name>
  <description>hawtio :: OSGi Web Console</description>

  <dependencies>

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

    <!-- mandatory core hawito modules -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-system</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-util</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- hawtio-console-assembly is needed to ensure build order -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-console-assembly</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <type>pom</type>
    </dependency>

    <!-- blueprint is mandatory as it's for dependency injection and bootstrapping services -->
    <dependency>
      <groupId>org.apache.aries.blueprint</groupId>
      <artifactId>org.apache.aries.blueprint.web</artifactId>
      <version>${blueprint-web-version}</version>
      <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>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>

      <!-- Add hawtio-console resources to the WAR -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <directory>../../hawtio-console-assembly/dist/</directory>
              <includes>
                <include>**/*.*</include>
              </includes>
            </resource>
          </webResources>
          <archive>
            <manifestFile>${project.build.directory}/classes/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven-bundle-plugin-version}</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <supportedProjectTypes>
            <supportedProjectType>war</supportedProjectType>
          </supportedProjectTypes>
          <instructions>
            <Webapp-Context>${context}</Webapp-Context>
            <Web-ContextPath>${context}</Web-ContextPath>

            <Embed-Directory>WEB-INF/lib</Embed-Directory>
            <Embed-Dependency>*;scope=compile|runtime;artifactId=!org.osgi.enterprise|org.osgi.core</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>

            <Import-Package>
              org.apache.commons.logging;resolution:=optional,
              org.slf4j;resolution:=optional;version="[1.6,2)",
              org.apache.karaf.jaas.boot.principal;resolution:=optional,
              !org.slf4j.impl,
              !org.apache.avalon*,
              !org.apache.log*,
              !javax.jmdns*,!javax.jms*,!javax.portlet*,
              !com.ibm.uvm.tools*,
              !com.sun.jdmk.comm*,!com.sun.net*,!com.sun.tools*,!sun.security.x509*,
              !com.google.errorprone.annotations.concurrent,
              *
            </Import-Package>
            <Export-Package>
              !*
            </Export-Package>

            <Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath>
            <Bundle-Name>${project.description}</Bundle-Name>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Implementation-Title>hawtio osgi</Implementation-Title>
            <Implementation-Version>${project.version}</Implementation-Version>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/overlays</directory>
              <includes>
                <include>**/*.*</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
