<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>org.exoplatform.addons.caldav</groupId>
    <artifactId>caldav-parent</artifactId>
    <version>7.3.0-20260921</version>
  </parent>
  <artifactId>caldav-webapp</artifactId>
  <packaging>war</packaging>
  <name>eXo Caldav - Application</name>
  <properties>
    <!-- Default for the npm-test execution's skip flag: -DskipTests flips it
         to true exactly as it does for surefire. -->
    <skipTests>false</skipTests>
  </properties>
  <dependencies>
    <!-- Brings the Spring/kernel bridge (io.meeds.spring) the bootstrap class
         extends, transitively and version-aligned — the same single dependency
         email-connector's webapp boots Spring with. -->
    <dependency>
      <groupId>io.meeds.social</groupId>
      <artifactId>social-component-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.meeds.platform-ui</groupId>
      <artifactId>platform-ui-skin</artifactId>
      <classifier>sources</classifier>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>caldav</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>less-copy-resources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/src/main/webapp/skin/less</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/webapp/skin/less</directory>
                </resource>
              </resources>
              <overwrite>true</overwrite>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>platform-ui-src</id>
            <phase>initialize</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>platform-ui-skin</includeArtifactIds>
              <outputDirectory>${project.build.directory}/src/main/webapp</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <executions>
          <!-- The connector-descriptor regression tests (jest): the contract
               agenda's My Calendars panel holds every descriptor to broke
               silently once, and only a test at this level catches it.
               Bound to prepare-package, not test: the parent installs
               node/npm at prepare-package, so a test-phase run only found a
               node binary left over from a previous build - after mvn clean
               it failed before node was ever installed. Child executions run
               after the parent's within the same phase, so node, the npm
               deps and the webpack build all precede this. -->
          <execution>
            <id>npm test</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <arguments>run test</arguments>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <packagingExcludes>WEB-INF/lib/**,**/less/**,**/*.vue,css/lib/*,vue-app/**,js/mock/**/*,**-dev.*</packagingExcludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
