<?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>9.0.0</version>
    </parent>

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

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

    <properties>
        <license.dir>${project.basedir}/src/main/resources/license</license.dir>
        <license.output.dir>${project.build.directory}/licenses</license.output.dir>
        <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>verify</phase>
                        <configuration>
                            <install-dir>${project.build.directory}/wildfly-camel-${project.version}</install-dir>
                            <offline>false</offline>
                            <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-local>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-pack</artifactId>
                                    <version>${project.version}</version>
                                </resolve-local>
                            </resolve-locals>
                            <feature-packs>
                                <feature-pack>
                                    <groupId>org.wildfly.camel</groupId>
                                    <artifactId>wildfly-camel-feature-pack</artifactId>
                                    <version>${project.version}</version>
                                    <inherit-configs>true</inherit-configs>
                                </feature-pack>
                            </feature-packs>
                            <plugin-options>
                                <jboss-fork-embedded />
                                <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>verify</phase>
                        <configuration>
                            <source>${project.basedir}/scripts/module-checker.groovy</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>
            <plugin>
                <groupId>org.ec4j.maven</groupId>
                <artifactId>editorconfig-maven-plugin</artifactId>
                <configuration>
                    <excludes combine.children="append">
                        <exclude>**/license/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <!-- <profiles>
        <profile>
            Needs to get re-enabled - see https://github.com/wildfly-extras/wildfly-camel/issues/2700
            <id>update-licenses-xml</id>
            <activation>
                <property>
                    <name>!skip-update-licenses-xml</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.gmaven</groupId>
                        <artifactId>groovy-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>update-licenses-xml</id>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <phase>compile</phase>
                                <configuration>
                                    <source>${project.basedir}/scripts/update-licenses-xml.groovy</source>
                                </configuration>
                            </execution>
                            <execution>
                                <id>update-licenses-dependencies</id>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <source>${project.basedir}/scripts/update-licenses-dependencies.groovy</source>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.httpcomponents</groupId>
                                <artifactId>httpclient</artifactId>
                                <version>${version.camel.httpclient}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-license-assets</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${license.output.dir}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${license.dir}/licenses</directory>
                                            <includes>
                                                <include>*</include>
                                            </includes>
                                            <filtering>false</filtering>
                                        </resource>
                                        <resource>
                                            <directory>${license.dir}/assets</directory>
                                            <includes>
                                                <include>*</include>
                                            </includes>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.wildfly.maven.plugins</groupId>
                        <artifactId>licenses-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>update-licenses-xml</id>
                                <goals>
                                    <goal>insert-versions</goal>
                                </goals>
                                <phase>compile</phase>
                                <configuration>
                                    <licensesConfigFile>${license.dir}/licenses.xml</licensesConfigFile>
                                    <licensesOutputDirectory>${license.output.dir}</licensesOutputDirectory>
                                    <licensesOutputFile>${license.output.dir}/licenses.xml</licensesOutputFile>
                                    <sortByGroupIdAndArtifactId>true</sortByGroupIdAndArtifactId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-licenses-html</id>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <transformationSets>
                                        <transformationSet>
                                            <dir>${license.output.dir}</dir>
                                            <includes>
                                                <include>*licenses.xml</include>
                                            </includes>
                                            <stylesheet>${license.dir}/assets/licenses.xsl</stylesheet>
                                            <outputDir>${license.output.dir}</outputDir>
                                            <fileMappers>
                                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                                    <targetExtension>.html</targetExtension>
                                                </fileMapper>
                                            </fileMappers>
                                            <parameters>
                                                <parameter>
                                                    <name>version</name>
                                                    <value>${project.version}</value>
                                                </parameter>
                                            </parameters>
                                        </transformationSet>
                                    </transformationSets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        Activate this profile to download license info
        <profile>
            <id>generate-licenses-xml</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>download-licenses</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <licensesOutputDirectory>${license.dir}/licenses</licensesOutputDirectory>
                                    <licensesOutputFile>${license.dir}/licenses.xml</licensesOutputFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles> -->
</project>
