<?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>account-applications</artifactId>
    <version>1.13.0-SNAPSHOT</version>
  </parent>

  <groupId>ru.micord.ervu.account_applications</groupId>
  <artifactId>distribution</artifactId>
  <packaging>ear</packaging>

  <properties>
    <backendContext>/${project.parent.artifactId}</backendContext>
  </properties>

  <dependencies>
    <dependency>
      <groupId>ru.micord.ervu.account_applications</groupId>
      <artifactId>backend</artifactId>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>ru.micord.ervu.account_applications</groupId>
      <artifactId>frontend</artifactId>
      <type>war</type>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <modules>
            <webModule>
              <groupId>ru.micord.ervu.account_applications</groupId>
              <artifactId>frontend</artifactId>
              <contextRoot>/</contextRoot>
              <bundleFileName>frontend.war</bundleFileName>
            </webModule>
            <webModule>
              <groupId>ru.micord.ervu.account_applications</groupId>
              <artifactId>backend</artifactId>
              <contextRoot>${backendContext}</contextRoot>
              <bundleFileName>${project.parent.artifactId}.war</bundleFileName>
            </webModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
    <finalName>${project.parent.artifactId}</finalName>
  </build>

  <profiles>
    <profile>
      <id>enable-version-in-url</id>
      <properties>
        <backendContext>/${project.parent.artifactId}-${project.version}</backendContext>
      </properties>
    </profile>
  </profiles>
</project>
