<?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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>frontend-plugins</artifactId>
    <groupId>com.github.eirslett</groupId>
    <version>1.6</version>
  </parent>

  <artifactId>frontend-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>

  <name>Maven Frontend Plugin</name>
  <prerequisites>
    <maven>3.1.0</maven>
  </prerequisites>

  <description>
        This Maven plugin lets you install Node/NPM locally
        for your project, install dependencies with NPM,
        install dependencies with bower or jspm, run Grunt or gulp tasks,
        and/or run Karma tests.
    </description>

  <dependencies>
    <dependency>
      <groupId>com.github.eirslett</groupId>
      <artifactId>frontend-plugin-core</artifactId>
      <version>${project.parent.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.1.0</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.2</version>
    </dependency>

    <dependency>
      <groupId>org.sonatype.plexus</groupId>
      <artifactId>plexus-build-api</artifactId>
      <version>0.0.7</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.2</version>
        <configuration>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <phase>process-classes</phase>
            <goals>
              <goal>descriptor</goal>
            </goals>
            <configuration>
              <goalPrefix>frontend</goalPrefix>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- For the integration test -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>mrm-maven-plugin</artifactId>
        <version>1.0-beta-2</version>
        <executions>
          <execution>
            <goals>
              <goal>start</goal>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <propertyName>repository.proxy.url</propertyName>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>2.0.0</version>

        <configuration>
          <debug>true</debug>
          <projectsDirectory>src/it</projectsDirectory>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <settingsFile>src/it/settings.xml</settingsFile>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <streamLogs>true</streamLogs>
          <postBuildHookScript>verify</postBuildHookScript>
          <filterProperties>
            <repository.proxy.url>${repository.proxy.url}</repository.proxy.url>
          </filterProperties>
        </configuration>

        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>Skip tests</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <skipInvocation>true</skipInvocation>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
