<?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>
    <groupId>ru.micord.ervu</groupId>
    <artifactId>eks</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>

  <groupId>ru.micord.ervu.eks</groupId>
  <artifactId>frontend</artifactId>
  <packaging>war</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <id>replace-version-in-url</id>
            <phase>process-resources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <includes>
            <include>${basedir}/src/resources/app-config.json</include>
            <include>${basedir}/dist/src/resources/app-config.json</include>
            <include>${basedir}/src/resources/app.version</include>
            <include>${basedir}/dist/src/resources/app.version</include>
          </includes>
          <replacements>
            <replacement>
              <token>%project.version%</token>
              <value>${project.version}</value>
            </replacement>
            <replacement>
              <token>%enable.version.in.url%</token>
              <value>${enable.version.in.url}</value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dev</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <copyWebResources>false</copyWebResources>
              <webResources>
                <resource>
                  <directory>${basedir}</directory>
                  <includes>
                    <include>src/resources/**/*</include>
                    <include>build_dev/**/*</include>
                    <include>node_modules/**/*</include>
                    <include>index.html</include>
                    <include>systemjs.config.js</include>
                  </includes>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>compile-ts</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
    </profile>
    <profile>
      <id>prod</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <copyWebResources>false</copyWebResources>
              <webResources>
                <resource>
                  <directory>${basedir}/dist</directory>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>enable-version-in-url</id>
      <properties>
        <enable.version.in.url>true</enable.version.in.url>
      </properties>
    </profile>
  </profiles>
</project>
