<?xml version="1.0" encoding="UTF-8"?>

<!-- ~ Copyright 2012 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under the Eclipse Public License version 1.0, available
    at ~ http://www.eclipse.org/legal/epl-v10.html -->

<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.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>22</version>
        <relativePath />
    </parent>

    <groupId>org.jboss.windup</groupId>
    <artifactId>rhamt-cli</artifactId>
    <version>4.0.1.Final</version>

    <name>RHAMT - Distribution Build</name>
    <packaging>pom</packaging>

    <properties>
        <version.windup>4.0.1.Final</version.windup>
        <version.forge>3.6.0.Final</version.forge>
        <version.furnace>2.25.4.Final</version.furnace>

        <windup.scm.connection>scm:git:https://github.com/windup/windup-distribution.git</windup.scm.connection>
        <windup.developer.connection>scm:git:git@github.com:windup/windup-distribution.git</windup.developer.connection>
        <windup.scm.url>http://github.com/windup/windup-distribution</windup.scm.url>
    </properties>
    
    <dependencyManagement>
        <dependencies>
            <dependency>
               <groupId>org.jboss.windup</groupId>
               <artifactId>windup-bom</artifactId>
               <version>${version.windup}</version>
               <type>pom</type>
               <scope>import</scope>
           </dependency>
           <dependency>
                <groupId>org.jboss.windup.rules</groupId>
                <artifactId>windup-rulesets</artifactId>
                <version>${version.windup}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jboss.windup</groupId>
            <artifactId>windup-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.windup.maven</groupId>
            <artifactId>nexus-indexer-data</artifactId>
            <type>zip</type>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.windup.maven</groupId>
                    <artifactId>nexus-indexer</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.windup.rules</groupId>
            <artifactId>windup-rulesets</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jboss.forge.furnace</groupId>
                <artifactId>furnace-maven-plugin</artifactId>
                <version>${version.furnace}</version>
                <executions>
                    <execution>
                        <id>deploy-addons</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>addon-install</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <addonRepository>${project.build.directory}/addons</addonRepository>
                            <addonIds>
                                <addonId>org.jboss.forge.furnace.container:cdi,${version.furnace}</addonId>
                                <addonId>org.jboss.forge.furnace.container:simple,${version.furnace}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java,${version.windup}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java-project,${version.windup}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java-ee,${version.windup}</addonId>
                                <addonId>org.jboss.windup:windup-tooling,${version.windup}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-tattletale,${version.windup}</addonId>
                            </addonIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.windup.rules</groupId>
                                    <artifactId>windup-rulesets</artifactId>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/rules</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <excludes>**/tests/**</excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-dump</id>
                        <phase>package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.jboss.windup.bootstrap.Bootstrap</mainClass>
                    <cleanupDaemonThreads>false</cleanupDaemonThreads>
                    <arguments>
                        <argument>--addonDir</argument>
                        <argument>${project.build.directory}/addons</argument>
                        <argument>--batchMode</argument>
                        <argument>--generateCaches</argument>
                        <argument>--userRulesDirectory</argument>
                        <argument>${project.build.directory}/rules</argument>
                    </arguments>
                    <systemProperties>
                        <systemProperty>
                            <key>windup.home</key>
                            <value>${project.build.directory}/</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>distribution-offline</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly-offline.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>download-licenses</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <licensesOutputDirectory>
                                        ${project.build.directory}/rhamt-distribution-${project.version}/docs/licenses
                                    </licensesOutputDirectory>
                                    <licensesOutputFile>
                                        ${project.build.directory}/rhamt-distribution-${project.version}/docs/licenses/licenses.xml
                                    </licensesOutputFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Adds the Rexster addon to the build, for debug purposes. -->
        <profile>
            <id>add-rexster</id>
            <activation>
                <property>
                    <name>rexster</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jboss.forge.furnace</groupId>
                        <artifactId>furnace-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>deploy-addons</id>
                                <configuration>
                                    <addonIds combine.children="append">
                                        <addonId>org.jboss.windup.rexster:windup-rexster,${version.windup}</addonId>
                                    </addonIds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <tag>4.0.1.Final</tag>
        <connection>${windup.scm.connection}</connection>
        <developerConnection>${windup.developer.connection}</developerConnection>
        <url>${windup.scm.url}</url>
    </scm>
    <issueManagement>
        <system>JBoss Jira</system>
        <url>https://issues.jboss.org/browse/WINDUP</url>
    </issueManagement>
    <mailingLists>
        <mailingList>
            <name>Windup Rules Development and Usage</name>
            <post>windup-users@lists.jboss.org</post>
            <archive>http://lists.jboss.org/pipermail/windup-users/</archive>
        </mailingList>
        <mailingList>
            <name>Windup Core Development</name>
            <post>windup-dev@lists.jboss.org</post>
            <archive>http://lists.jboss.org/pipermail/windup-dev/</archive>
        </mailingList>
    </mailingLists>
</project>
