<!--
Copyright 2011 Normation SAS

This file is part of Rudder.

Rudder is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

In accordance with the terms of section 7 (7. Additional Terms.) of
the GNU General Public License version 3, the copyright holders add
the following Additional permissions:
Notwithstanding to the terms of section 5 (5. Conveying Modified Source
Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU General
Public License version 3, when you create a Related Module, this
Related Module is not considered as a part of the work and may be
distributed under the license agreement of your choice.
A "Related Module" means a set of sources files including their
documentation that, without modification of the Source Code, enables
supplementary functions or services in addition to those offered by
the Software.

Rudder is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Rudder.  If not, see <http://www.gnu.org/licenses/>.
-->
<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>rudder-web</artifactId>
  <packaging>war</packaging>

  <parent>
    <groupId>com.normation.rudder</groupId>
    <artifactId>rudder-parent</artifactId>
    <version>8.3.9</version>
  </parent>

  <description>
    This is the web front end project that manage the CMDB
  </description>

  <repositories>
    <repository>
      <id>Sonatype snapshot</id>
      <name>Sonatype OSS repository - snapshots</name>
      <url>https://oss.sonatype.org/content/groups/public</url>
      <snapshots><enabled>true</enabled></snapshots>
      <releases><enabled>false</enabled></releases>
    </repository>
  </repositories>

  <build>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources/</directory>
        <excludes>
          <exclude>version.properties</exclude>
          <exclude>configuration.properties.sample</exclude>
        </excludes>
      </resource>
      <resource>
        <filtering>true</filtering>
        <directory>${project.basedir}/src/main/resources/</directory>
        <includes>
          <include>version.properties</include>
        </includes>
      </resource>
    </resources>

    <plugins>
       <!-- this is needed to have Rudder plugins access rudder-web in jar format -->
       <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <attachClasses>true</attachClasses>
          <webResources>
            <resource>
              <filtering>true</filtering>
              <directory>${project.basedir}/src/main/webapp/</directory>
              <includes>
                <include>index.html</include>
                <include>templates-hidden/common-layout.html</include>
              </includes>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>7.1.6.v20100715</version>
        <configuration>
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <webAppConfig>
            <contextPath>/rudder-web</contextPath>
          </webAppConfig>
        </configuration>
      </plugin>
     <!-- we need to be able to depend on tests for plugin -->
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>test-jar</goal>
           </goals>
         </execution>
       </executions>
        <configuration>
          <excludes>
            <exclude>**/logback-test.xml</exclude>
            <exclude>**/node_modules</exclude>
          </excludes>
        </configuration>
      </plugin>
      <!-- For elm parts: copy resources and build elm app -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-elm-toserve</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>target/classes/toserve/${destDirectory}</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/elm/*/generated</directory>
                  <includes>
                    <include>*.css</include>
                    <include>*.js</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <id>build-frontend</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>src/main/build.sh</executable>
              <commandlineArgs>--release</commandlineArgs>
            </configuration>
          </execution>
          <execution>
            <id>elm-test</id>
            <phase>test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>npx</executable>
              <workingDirectory>src/main/elm</workingDirectory>
              <commandlineArgs>elm-test "sources/**/tests"</commandlineArgs>
            </configuration>
          </execution>
          <execution>
            <id>elm-review</id>
            <phase>test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>npx</executable>
              <workingDirectory>src/main/elm</workingDirectory>
              <commandlineArgs>elm-review</commandlineArgs>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <properties>
    <!-- seriously, maven...  http://stackoverflow.com/questions/13228472/how-to-acces-maven-build-timestamp-for-resource-filtering#13228882 -->
    <build-timestamp>${maven.build.timestamp}</build-timestamp>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
      <version>${reflections-version}</version>
    </dependency>

    <dependency>
      <groupId>com.normation.rudder</groupId>
      <artifactId>rudder-rest</artifactId>
      <version>${rudder-version}</version>
    </dependency>
    <dependency>
      <groupId>com.normation.inventory</groupId>
      <artifactId>inventory-provisioning-core</artifactId>
      <version>${rudder-version}</version>
    </dependency>
    <dependency>
      <groupId>com.normation.inventory</groupId>
      <artifactId>inventory-fusion</artifactId>
      <version>${rudder-version}</version>
    </dependency>

    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <!-- the slf4j commons-logging replacement -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-expression</artifactId>
      <version>${spring-version}</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
          <groupId>commons-logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring-version}</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
          <groupId>commons-logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>${spring-version}</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
          <groupId>commons-logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-web</artifactId>
      <version>${spring-security-version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring-beans</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-config</artifactId>
      <version>${spring-security-version}</version>
    </dependency>

    <!-- Needed for LDAP authentication -->
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-ldap</artifactId>
      <version>${spring-security-version}</version>
    </dependency>

    <!-- TESTS -->
    <dependency>
      <groupId>com.normation.rudder</groupId>
      <artifactId>rudder-core</artifactId>
      <version>${rudder-version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.normation.rudder</groupId>
      <artifactId>rudder-rest</artifactId>
      <version>${rudder-version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
