<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.exoplatform.ks</groupId>
    <artifactId>exo.ks.eXoApplication.wiki</artifactId>
    <version>2.2.15</version>
  </parent>
  <artifactId>exo.ks.eXoApplication.wiki.webapp</artifactId>
  <packaging>war</packaging>
  <name>eXo KS Wiki application</name>
  <properties>
    <gwt.style>DETAILED</gwt.style>
    <gwt.output.directory>${project.build.directory}/${project.build.finalName}/resources/js/xwiki/wysiwyg</gwt.output.directory>
    <xwe.directory>${gwt.output.directory}/xwe</xwe.directory>
    <xwe.module>org.xwiki.gwt.wysiwyg.WysiwygDev</xwe.module>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.exoplatform.kernel</groupId>
      <artifactId>exo.kernel.container</artifactId>
      <version>${org.exoplatform.kernel.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.component.portal</artifactId>
      <version>${org.exoplatform.portal.version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>pull-parser</groupId>
          <artifactId>pull-parser</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.webui.eXo</artifactId>
      <version>${org.exoplatform.portal.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.webui.portal</artifactId>
      <version>${org.exoplatform.portal.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.webui.core</artifactId>
      <version>${org.exoplatform.portal.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.commons</groupId>
      <artifactId>exo.platform.commons.webui.ext</artifactId>
      <version>${org.exoplatform.commons.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.exoplatform.ks</groupId>
      <artifactId>exo.ks.eXoApplication.wiki.service</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>pull-parser</groupId>
          <artifactId>pull-parser</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${org.apache.commons.version}</version>
    </dependency>

     <!-- GWT core dependencies -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>
    
    <!-- GWT libraries -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-wysiwyg-client</artifactId>
      <version>${org.xwiki.platform.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${javax.servlet.servlet-api.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.smartgwt</groupId>
      <artifactId>smartgwt</artifactId>
      <version>${smartgwt.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-gwt-user</artifactId>
      <version>${org.xwiki.platform.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-gwt-dom</artifactId>
      <version>${org.xwiki.platform.version}</version>
      <scope>provided</scope>
    </dependency>    
    
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-wysiwyg-plugin-api</artifactId>
      <version>${org.xwiki.platform.version}</version>
      <scope>provided</scope>
    </dependency>    
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
     <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <finalName>wiki</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.2.0</version>
        <configuration>
          <module>${xwe.module}</module>
          <webappDirectory>${gwt.output.directory}</webappDirectory>
          <style>${gwt.style}</style>
          <disableCastChecking>true</disableCastChecking>
          <disableClassMetadata>true</disableClassMetadata>
          <soyc>false</soyc>
          <extraJvmArgs>-Xmx1024m -Xss1024k -Djava.awt.headless=true</extraJvmArgs>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.smartgwt</groupId>
                  <artifactId>smartgwt</artifactId>
                  <version>${smartgwt.version}</version>
                  <type>jar</type>
                  <outputDirectory>${project.build.directory}/smartclient</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <archiveClasses>true</archiveClasses>
          <webResources>
            <!-- Add SmartClient skins -->
            <resource>
              <directory>${project.build.directory}/smartclient/com/smartclient/theme/enterprise/public/sc/skins</directory>
              <targetPath>resources/js/xwiki/wysiwyg/xwe/sc/skins</targetPath>
              <filtering>false</filtering>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <executions>
          <execution>
            <phase>install</phase>
            <goals>
              <goal>install-file</goal>
            </goals>
            <configuration>
              <packaging>jar</packaging>
              <artifactId>${project.artifactId}</artifactId>
              <groupId>${project.groupId}</groupId>
              <version>${project.version}</version>
              <file>${project.build.directory}/wiki/WEB-INF/lib/${project.artifactId}-${project.version}.jar</file>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <!--
            We exclude the SmartClient JavaScript files which are provided by the final distribution war. We also
            exclude the deployable but not servable files generated by the GWT compiler.
          -->
          <packagingExcludes>**/gwt-unitCache/**</packagingExcludes>
        </configuration>
      </plugin>
      <plugin>
        <!-- JavaScript and CSS files compression and concatenation -->
        <groupId>net.sf.alchim</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <version>0.7.1</version>
        <configuration>
          <!-- Overwrite the resource files with the minimized version. -->
          <nosuffix>true</nosuffix>
        </configuration>
        <executions>
          <execution>
            <id>aggregate-css</id>
            <!-- Compress and aggregate the CSS files after the GWT code is compiled, just before packaging the war. -->
            <phase>prepare-package</phase>
            <goals>
              <goal>compress</goal>
            </goals>
            <configuration>
              <sourceDirectory>${xwe.directory}/stylesheets</sourceDirectory>
              <outputDirectory>${xwe.directory}/stylesheets</outputDirectory>
              <!-- A hack to not include js and css files in /javascript and /skin  -->
              <warSourceDirectory>${basedir}/src/main/webapp/templates</warSourceDirectory>
              <aggregations>
                <aggregation>
                  <removeIncluded>true</removeIncluded>
                  <!-- If we overwrite directly Wysiwyg.css then it's content is not included in the aggregation. -->
                  <output>${xwe.directory}/stylesheets/Wysiwyg-all.css</output>
                  <includes>
                    <include>*.css</include>
                  </includes>
                  <excludes>
                    <!--
                      RichTextArea.css is included by the editing template and applies only to the edited content
                      (the document of the in-line frame). The rest of the CSS files are applied to the page hosting the
                      WYSIWYG editor (the document that contains the in-line frame).
                    -->
                    <exclude>RichTextArea.css</exclude>
                  </excludes>
                </aggregation>
                <!-- 
                <aggregation>
                  <removeIncluded>true</removeIncluded>
                  <output>${xwe.directory}/stylesheets/Wysiwyg.css</output>
                  <includes>
                    <include>Wysiwyg-all.css</include>
                  </includes>
                </aggregation>
                -->
              </aggregations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <gwt.style>OBF</gwt.style>
        <xwe.module>org.xwiki.gwt.wysiwyg.Wysiwyg</xwe.module>
      </properties>
    </profile>
    <profile>
      <id>test</id>
      <properties>
        <gwt.style>OBF</gwt.style>
        <xwe.module>org.xwiki.gwt.wysiwyg.Wysiwyg</xwe.module>
      </properties>
    </profile>
    <profile>
      <id>dev</id>
      <properties>
        <gwt.style>DETAILED</gwt.style>
        <xwe.module>org.xwiki.gwt.wysiwyg.WysiwygDev</xwe.module>
      </properties>
    </profile>
  </profiles>
	
</project>
