<?xml version="1.0" encoding="UTF-8"?>

<!--
  *
  * See the NOTICE file distributed with this work for additional
  * information regarding copyright ownership.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  *
-->

<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>
  <parent>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-workspace</artifactId>
    <version>5.0-milestone-1</version>
  </parent>
  <artifactId>xwiki-platform-workspace-ui</artifactId>
  <packaging>xar</packaging>
  <name>XWiki Platform - Workspace - UI</name>
  <description>XWiki application that manages workspaces.</description>
  <properties>
    <!-- Name to display by the Extension Manager -->
    <xwiki.extension.name>Workspace Application</xwiki.extension.name>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-workspace-api</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-wiki-manager-api</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <!-- Step 1: Download workspace template features xar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <!-- <phase>generate-sources</phase> -->
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>xwiki-platform-workspace-template-features</artifactId>
                  <version>${project.version}</version>
                  <type>xar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}/template-features</outputDirectory>
                  <destFileName>workspace-template-features.xar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Step 2: Attach template features xar to WorkspaceManager install page -->
      <plugin>
        <groupId>org.xwiki.platform</groupId>
        <artifactId>xwiki-platform-tool-xmldoc-update-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <id>attach-template-features-xar</id>
            <goals>
              <goal>attach</goal>
            </goals>
            <configuration>
              <file>${project.build.directory}/template-features/workspace-template-features.xar</file>
              <sourceDocument>${basedir}/src/main/resources/WorkspaceManager/Install.xml</sourceDocument>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>clover</id>
      <build>
        <plugins>
          <!-- Add the Clover JAR to the XMLDOC update plugin runtime classpath since this plugin uses java classes
               that have been instrumented with Clover (XWiki oldcore for example) -->
          <plugin>
            <groupId>org.xwiki.platform</groupId>
            <artifactId>xwiki-platform-tool-xmldoc-update-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>com.cenqua.clover</groupId>
                <artifactId>clover</artifactId>
                <version>3.1.6</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>