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

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

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

  <properties>
    <integrationTestProfiles>it-Linux</integrationTestProfiles>
  </properties>

  <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.9.2</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.9.2</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.9.0</version>
      <scope>provided</scope>
    </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.9.0</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>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integrationTests</id>
      <build>
        <plugins>
          <!-- For the integration test -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>mrm-maven-plugin</artifactId>
            <version>1.5.0</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>3.6.0</version>

            <configuration>
              <debug>true</debug>
              <profiles>${integrationTestProfiles}</profiles>
              <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>
    </profile>
  </profiles>
</project>
