<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Wildfly Camel Enricher
  %%
  Copyright (C) 2013 - 2014 RedHat
  %%
  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.
  #L%
  -->


<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>
        <groupId>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel-feature</artifactId>
        <version>10.2.0</version>
    </parent>

    <name>Wildfly Camel :: Feature :: Pack</name>

    <artifactId>wildfly-camel-feature-pack</artifactId>
    <packaging>pom</packaging>

    <properties>
        <wildfly.camel.dir>${project.build.directory}/wildfly-camel-${project.version}</wildfly.camel.dir>
        <wildfly-camel-feature-pack.basedir>${project.basedir}</wildfly-camel-feature-pack.basedir>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.camel</groupId>
                <artifactId>wildfly-camel-bom</artifactId>
                <version>${project.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-feature-modules</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-feature-extrasA</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-feature-extrasB</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-feature-extrasC</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jboss.galleon</groupId>
                <artifactId>galleon-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>provision-wildfly-camel</id>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <install-dir>${project.build.directory}/wildfly-camel-${project.version}</install-dir>
                            <record-state>false</record-state><!-- speedup by avoiding to save any state to .galleon dir  -->
                            <offline>false</offline>
                            <log-time>true</log-time>
                            <resolve-locals>
                                <resolve-local>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-modules</artifactId>
                                    <version>${project.version}</version>
                                </resolve-local>
                                <resolve-local>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-extrasA</artifactId>
                                    <version>${project.version}</version>
                                </resolve-local>
                                <resolve-local>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-extrasB</artifactId>
                                    <version>${project.version}</version>
                                </resolve-local>
                                <resolve-local>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-extrasC</artifactId>
                                    <version>${project.version}</version>
                                </resolve-local>
                            </resolve-locals>
                            <feature-packs>
                                <feature-pack>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-extrasB</artifactId>
                                    <version>${project.version}</version>
                                    <inherit-configs>false</inherit-configs>
                                    <inherit-packages>false</inherit-packages>
                                    <includedPackages>
                                        <includedPackage>modules.all</includedPackage><!-- we want only the modules directory -->
                                    </includedPackages>
                                </feature-pack>
                                <feature-pack>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-extrasC</artifactId>
                                    <version>${project.version}</version>
                                    <inherit-configs>false</inherit-configs>
                                    <inherit-packages>false</inherit-packages>
                                    <includedPackages>
                                        <includedPackage>modules.all</includedPackage><!-- we want only the modules directory -->
                                    </includedPackages>
                                </feature-pack>
                            </feature-packs>
                            <plugin-options>
                                <jboss-fork-embedded>false</jboss-fork-embedded>
                                <jboss-maven-dist>true</jboss-maven-dist>
                            </plugin-options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>module-check</id>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <source>${project.basedir}/scripts/module-checker.groovy</source>
                        </configuration>
                    </execution>
                    <execution>
                        <id>create-dist-dir</id>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <source>// workaround for https://issues.jboss.org/browse/GAL-261
                              java.nio.file.Files.createDirectories(java.nio.file.Paths.get("${basedir}/target/wildfly-camel-9.2.0-SNAPSHOT"))
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.galleon-plugins</groupId>
                <artifactId>wildfly-galleon-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>feature-pack-build</id>
                        <goals>
                            <goal>build-feature-pack</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
