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

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.ops4j.pax.cdi</groupId>
        <version>1.0.0.RC2</version>
        <artifactId>pax-cdi-parent</artifactId>
        <relativePath>../pax-cdi-parent</relativePath>
    </parent>

    <artifactId>pax-cdi-features</artifactId>
    <packaging>pom</packaging>

    <name>OPS4J Pax CDI Karaf Features</name>

    <description>
        Pax Cdi module creating a features xml file to deploy Pax Cdi components as features in Apache Karaf.
        To use this feature enter the following in your Karaf shell -
        features:addurl mvn:org.ops4j.pax.cdi/pax-cdi-features/${project.version}/xml/features
    </description>

    <properties>
        <dependency.karaf.version>4.0.4</dependency.karaf.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>framework</artifactId>
            <version>${dependency.karaf.version}</version>
            <type>kar</type>
            <scope>provided</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-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>
                <version>${dependency.karaf.version}</version>
                <executions>
                    <execution>
                        <id>verify</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>mvn:org.apache.karaf.features/framework/${dependency.karaf.version}/xml/features</descriptor>
                                <descriptor>mvn:org.apache.karaf.features/standard/${dependency.karaf.version}/xml/features</descriptor>
                                <descriptor>mvn:org.ops4j.pax.web/pax-web-features/${pax.web.version}/xml/features</descriptor>
                                <descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
                            </descriptors>
                            <distribution>org.apache.karaf.features:framework</distribution>
                            <javase>1.8</javase>
                            <framework>
                                <feature>framework</feature>
                            </framework>
                            <features>
                                <feature>pax-cdi</feature>
                                <feature>pax-cdi-weld</feature>
                                <feature>pax-cdi-openwebbeans</feature>
                                <feature>pax-cdi-web</feature>
                                <feature>pax-cdi-web-weld</feature>
                                <feature>pax-cdi-web-openwebbeans</feature>
                                <feature>deltaspike-*</feature>
                            </features>
                            <verifyTransitive>false</verifyTransitive>
                            <ignoreMissingConditions>true</ignoreMissingConditions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/features.xml</file>
                                    <type>xml</type>
                                    <classifier>features</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
