<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId><%= app_name %>-srv</artifactId>
  <groupId>customer</groupId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>
  <name><%= app_name %>-srv</name>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.sap.cloud.servicesdk</groupId>
        <artifactId>odata-v4-bom</artifactId>
        <version>1.39.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.sap.cloud.servicesdk.prov</groupId>
      <artifactId>odatav4</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sap.cloud.servicesdk</groupId>
      <artifactId>odata-v2-connectivity</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.7</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <properties>
    <packageName><%= java_package %></packageName>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <jacoco.destFile>${project.build.directory}/coverage-reports/jacoco.exec</jacoco.destFile>
    <jacoco.outputDirectory>${project.reporting.outputDirectory}/jacoco</jacoco.outputDirectory>
  </properties>
  <build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.4</version>
          <configuration>
            <webResources>
              <resource>
                <filtering>true</filtering>
                <directory>src/main/webapp</directory>
                <includes>
                  <include>**/web.xml</include>
                </includes>
              </resource>
            </webResources>
            <attachClasses>true</attachClasses>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.1</version>
          <configuration>
            <destFile>${jacoco.destFile}</destFile>
            <dataFile>${jacoco.destFile}</dataFile>
          </configuration>
          <executions>
            <execution>
              <id>pre-unit-test</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>post-unit-test</id>
              <phase>test</phase>
              <goals>
                <goal>report</goal>
              </goals>
              <configuration>
                <outputDirectory>${jacoco.outputDirectory}</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <configuration>
          <workingDirectory>${project.basedir}/../</workingDirectory>
        </configuration>
        <executions>
          <execution>
            <id>npm install</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <executable>npm</executable>
              <arguments>
                <argument>install</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>npm cds build</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <executable>npm</executable>
              <arguments>
                <argument>run</argument>
                <argument>build</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>connection.properties</exclude>
        </excludes>
      </resource>
    </resources>
  </build>
  <profiles>
    <profile>
      <activation>
        <property>
          <name>devmode</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
              <webResources combine.children="append">
                <resource>
                  <directory>${project.build.sourceDirectory}</directory>
                  <targetPath>sources</targetPath>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>only-eclipse</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sap.cloud.db.jdbc</groupId>
          <artifactId>ngdbc</artifactId>
          <version>2.4.56</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <version>2.4</version>
              <configuration>
                <webResources>
                  <resource>
                    <filtering>true</filtering>
                    <directory>src/main/webapp</directory>
                    <includes>
                      <include>**/web.xml</include>
                    </includes>
                  </resource>
                </webResources>
                <attachClasses>true</attachClasses>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <versionRange>[1.6.0,)</versionRange>
                        <goals>
                          <goal>exec</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore/>
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>