<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>allure-core</artifactId>
        <groupId>ru.yandex.qatools.allure</groupId>
        <version>1.5.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <name>Allure Report Face</name>
    <artifactId>allure-report-face</artifactId>
    <packaging>war</packaging>

    <properties>
        <sonar.language>js</sonar.language>
        <sonar.sources>src/</sonar.sources>
        <sonar.tests>test/</sonar.tests>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.exclusions>node_modules/**</sonar.exclusions>
        <sonar.tests.exclusions>node_modules/**</sonar.tests.exclusions>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>call-npm</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.4</version>
                        <configuration>
                            <warSourceDirectory>target/allure-report</warSourceDirectory>
                            <failOnMissingWebXml>false</failOnMissingWebXml>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>0.0.27</version>
                        <executions>
                            <execution>
                                <id>install node and npm</id>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>v5.0.0</nodeVersion>
                                    <npmVersion>3.5.1</npmVersion>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm-install</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm-build</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>run build</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm-test</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>test</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                <allure.report.directory>${project.build.directory}/allure-report</allure.report.directory>
                <allure.issues.tracker.pattern>http://github.com/allure-framework/allure-core/issues/%s
                </allure.issues.tracker.pattern>
                <allure.tests.management.pattern>http://github.com/allure-framework/allure-core/tests/%s
                </allure.tests.management.pattern>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>ru.yandex.qatools.allure</groupId>
                    <artifactId>allure-report-data</artifactId>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-allure-model-test-resources</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${allure.results.directory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>
                                                ${project.parent.basedir}/allure-model/src/test/resources/allure-results
                                            </directory>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <mainClass>ru.yandex.qatools.allure.data.DummyReportGenerator</mainClass>
                            <arguments>
                                <argument>${allure.results.directory}</argument>
                                <argument>${allure.report.directory}</argument>
                            </arguments>
                            <systemProperties>
                                <property>
                                    <key>allure.issues.tracker.pattern</key>
                                    <value>${allure.issues.tracker.pattern}</value>
                                </property>
                                <property>
                                    <key>allure.tests.management.pattern</key>
                                    <value>${allure.tests.management.pattern}</value>
                                </property>
                            </systemProperties>
                            <additionalClasspathElements>
                                <classpathElement>
                                    ${settings.localRepository}/org/slf4j/slf4j-simple/1.7.12/slf4j-simple-1.7.12.jar
                                </classpathElement>
                            </additionalClasspathElements>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.slf4j</groupId>
                                <artifactId>slf4j-simple</artifactId>
                                <version>1.7.12</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
