<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->
<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>
    <artifactId>reef-examples</artifactId>
    <name>REEF Examples</name>

    <parent>
        <groupId>org.apache.reef</groupId>
        <artifactId>reef-project</artifactId>
        <version>0.16.0</version>
        <relativePath>../../..</relativePath>
    </parent>

    <properties>
        <rootPath>${basedir}/../../..</rootPath>
    </properties>

    <dependencies>
        <!-- REEF -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-runtime-local</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-runtime-standalone</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-runtime-yarn</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-runtime-mesos</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-io</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-checkpoint</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-webserver</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>reef-poison</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- End of REEF -->

        <!-- HADOOP -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- End of HADOOP -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.reef</groupId>
            <artifactId>reef-runtime-multi</artifactId>
            <version>${project.version}</version>
        </dependency>

    </dependencies>


    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <configLocation>lang/java/reef-common/src/main/resources/checkstyle-strict.xml</configLocation>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputFile>
                        ${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar
                    </outputFile>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>yarn-default.xml</exclude>
                                <exclude>yarn-version-info.properties</exclude>
                                <exclude>core-default.xml</exclude>
                                <exclude>LICENSE</exclude>
                                <exclude>META-INF/*</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <profiles>

        <profile>
            <id>HelloREEF</id>
            <build>
                <defaultGoal>exec:exec</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>-Djava.util.logging.config.class=org.apache.reef.util.logging.Config
                                </argument>
                                <!-- <argument>-Dlog4j.debug=true</argument> -->
                                <argument>-Dcom.microsoft.reef.runtime.local.folder=${project.build.directory}
                                </argument>
                                <argument>org.apache.reef.examples.hello.HelloREEF</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>HelloREEFHttp</id>
            <build>
                <defaultGoal>exec:exec</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>-Djava.util.logging.config.class=org.apache.reef.util.logging.Config
                                </argument>
                                <!-- <argument>-Dlog4j.debug=true</argument> -->
                                <argument>-Dcom.microsoft.reef.runtime.local.folder=${project.build.directory}
                                </argument>
                                <argument>org.apache.reef.examples.hellohttp.HelloREEFHttp</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>HelloREEFNoClient</id>
            <build>
                <defaultGoal>exec:exec</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>-Djava.util.logging.config.class=org.apache.reef.util.logging.Config
                                </argument>
                                <!-- <argument>-Dlog4j.debug=true</argument> -->
                                <argument>-Dcom.microsoft.reef.runtime.local.folder=${project.build.directory}
                                </argument>
                                <argument>org.apache.reef.examples.hello.HelloREEFNoClient</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>SuspendDemo</id>
            <build>
                <defaultGoal>exec:exec</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>-Dcom.microsoft.reef.runtime.local.folder=${project.build.directory}
                                </argument>
                                <argument>-Djava.util.logging.config.class=org.apache.reef.util.logging.Config
                                </argument>
                                <argument>org.apache.reef.examples.suspend.Launch</argument>
                                <argument>-delay</argument>
                                <argument>1</argument>
                                <argument>-cycles</argument>
                                <argument>20</argument>
                                <argument>-local</argument>
                                <argument>true</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>Pool</id>
            <build>
                <defaultGoal>exec:exec</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>-Dcom.microsoft.reef.runtime.local.folder=${project.build.directory}
                                </argument>
                                <argument>-Djava.util.logging.config.class=org.apache.reef.util.logging.Config
                                </argument>
                                <argument>org.apache.reef.examples.pool.Launch</argument>
                                <argument>-evaluators</argument>
                                <argument>4</argument>
                                <argument>-tasks</argument>
                                <argument>100</argument>
                                <argument>-delay</argument>
                                <argument>1</argument>
                                <argument>-local</argument>
                                <argument>true</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
