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

    <groupId>org.jboss.windup</groupId>
    <artifactId>windup-distribution</artifactId>
    <version>2.6.0.Final</version>

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

    <properties>
        <version.nexus.index>5</version.nexus.index>
        <version.windup>2.6.0.Final</version.windup>
        <version.forge>2.20.1.Final</version.forge>
        <version.furnace>2.22.7.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>
        </dependency>
        <dependency>
            <groupId>org.jboss.windup.rules</groupId>
            <artifactId>windup-rulesets</artifactId>
        </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.addon:addon-manager,${version.forge}</addonId>
                                <addonId>org.jboss.forge.addon:maven,${version.forge}</addonId>
                                <addonId>org.jboss.forge.addon:projects,${version.forge}</addonId>
                                <addonId>org.jboss.windup.ui:windup-ui,${project.version}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java,${project.version}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java-project,${project.version}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-java-ee,${project.version}</addonId>
                                <addonId>org.jboss.windup:windup-tooling,${project.version}</addonId>
                                <addonId>org.jboss.windup.rules.apps:windup-rules-tattletale,${project.version}</addonId>
                            </addonIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <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>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>build-dump</id>
                        <phase>package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.jboss.windup.bootstrap.Bootstrap</mainClass>
                    <arguments>
                        <argument>-a</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>target/</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.5</version>
                <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}/windup-distribution-${project.version}/docs/licenses
                                    </licensesOutputDirectory>
                                    <licensesOutputFile>
                                        ${project.build.directory}/windup-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,${project.version}</addonId>
                                    </addonIds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <tag>2.6.0.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>
