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

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  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>
  <parent>
    <groupId>org.phenotips</groupId>
    <artifactId>phenotips-components</artifactId>
    <version>1.2-milestone-5</version>
  </parent>
  <artifactId>phenotips-base-war</artifactId>
  <name>PhenoTips - Base War package</name>
  <description>Provides a base .war package containing no jars, just the configuration files and patched XWiki classes.</description>
  <packaging>war</packaging>
  <properties>
    <!-- By default we don't include Legacy modules and thus we don't need to exclude the non legacy JARs -->
    <xwiki.war.legacy.excludes />
    <checkstyle.skip>true</checkstyle.skip>
    <clirr.skip>true</clirr.skip>
  </properties>
  <dependencies>
    <!-- Needed for compiling patched Java code -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-context</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-observation-api</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-model</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-oldcore</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-container-api</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-container-servlet</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-skin-skinx</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-extension-api</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-extension-distribution</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-extension-repository-maven</artifactId>
      <version>${xwiki.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- Depend on the XWiki platform WAR to get all web resources. -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-web</artifactId>
      <version>${xwiki.version}</version>
      <type>war</type>
    </dependency>
    <!-- Skins -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-colibri</artifactId>
      <version>${xwiki.version}</version>
      <type>zip</type>
      <scope>runtime</scope>
    </dependency>
    <!-- Include the pedigree editor -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>pedigree-editor</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- Database connectors for MySQL and HSQLDB, the most commonly used ones. -->
    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>2.3.2</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.35</version>
    </dependency>
    <!-- Logging framework -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <!-- Inject XWiki's configuration (only xwiki.cfg, not hibernate.cfg.xml) -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>xwiki-configuration-resources</id>
          </execution>
          <execution>
            <id>xwiki-platform-tool-configuration-resources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <resourceBundles>
                <resourceBundle>org.xwiki.platform:xwiki-platform-tool-configuration-resources:${xwiki.version}</resourceBundle>
              </resourceBundles>
              <properties>
                <xwikiDbConnectionUrl>jdbc:hsqldb:file:${environment.permanentDirectory}/database/xwiki_db;shutdown=true;hsqldb.cache_size=50000;hsqldb.script_format=3;hsqldb.nio_max_size=512;hsqldb.lob_file_scale=16;hsqldb.default_table_type=cached;hsqldb.tx=mvcc</xwikiDbConnectionUrl>
                <xwikiDbConnectionUsername>sa</xwikiDbConnectionUsername>
                <xwikiDbConnectionPassword />
                <xwikiDbConnectionDriverClass>org.hsqldb.jdbcDriver</xwikiDbConnectionDriverClass>
                <xwikiDbDialect>org.hibernate.dialect.HSQLDialect</xwikiDbDialect>
                <xwikiDbHbmXwiki>xwiki.hbm.xml</xwikiDbHbmXwiki>
                <xwikiDbHbmFeeds>feeds.hbm.xml</xwikiDbHbmFeeds>
                <xwikiCfgPlugins>\
  com.xpn.xwiki.monitor.api.MonitorPlugin,\
  com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.JsResourceSkinExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.CssSkinExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.CssResourceSkinExtensionPlugin,\
  com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin,\
  com.xpn.xwiki.plugin.mail.MailPlugin,\
  com.xpn.xwiki.plugin.packaging.PackagePlugin,\
  com.xpn.xwiki.plugin.svg.SVGPlugin,\
  com.xpn.xwiki.plugin.fileupload.FileUploadPlugin,\
  com.xpn.xwiki.plugin.image.ImagePlugin,\
  com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin,\
  com.xpn.xwiki.plugin.diff.DiffPlugin,\
  com.xpn.xwiki.plugin.rightsmanager.RightsManagerPlugin,\
  com.xpn.xwiki.plugin.jodatime.JodaTimePlugin,\
  com.xpn.xwiki.plugin.mailsender.MailSenderPlugin</xwikiCfgPlugins>
                <xwikiCfgVirtual>0</xwikiCfgVirtual>
                <xwikiCfgVirtualUsepath>0</xwikiCfgVirtualUsepath>
                <xwikiCfgEditCommentMandatory>0</xwikiCfgEditCommentMandatory>
                <xwikiCfgDefaultSkin>colibri</xwikiCfgDefaultSkin>
                <xwikiCfgDefaultBaseSkin>colibri</xwikiCfgDefaultBaseSkin>
                <xwikiCfgEncoding>UTF-8</xwikiCfgEncoding>
                <xwikiCfgAdditionalProperties>
xwiki.plugin.watchlist.automaticwatch=none
xwiki.authentication.group.allgroupimplicit=1
xwiki.authentication.rightsclass=org.phenotips.security.authorization.ModularRightServiceImpl
xwiki.section.edit=0
xwiki.backlinks=0
xwiki.showviewaction=0
xwiki.defaultweb=data
xwiki.usedefaultweb=1
xwiki.usedefaultaction=0
xwiki.monitor=0
xwiki.store.attachment.hint=file
xwiki.store.attachment.versioning.hint=file
xwiki.store.attachment.recyclebin.hint=file
                </xwikiCfgAdditionalProperties>
                <xwikiPropertiesEnvironmentPermanentDirectory>/var/lib/phenotips/</xwikiPropertiesEnvironmentPermanentDirectory>
                <xwikiPropertiesAdditionalProperties>
model.reference.default.space=data
extension.repositories=maven-central:maven:https://nexus.phenotips.org/nexus/content/groups/public/
extension.repositories=maven-phenotips:maven:https://nexus.phenotips.org/nexus/content/repositories/releases/
extension.repositories=phenotips.org:xwiki:https://phenotips.org/rest/
rendering.transformations=macro
                </xwikiPropertiesAdditionalProperties>
              </properties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <!-- Include License resources -->
            <resource>
              <directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
              <targetPath>META-INF</targetPath>
            </resource>
            <resource>
              <directory>${project.build.directory}/maven-shared-archive-resources</directory>
              <targetPath>WEB-INF</targetPath>
              <includes>
                <include>xwiki.cfg</include>
                <include>xwiki.properties</include>
                <include>hibernate.cfg.xml</include>
              </includes>
            </resource>
          </webResources>
          <!-- - Exclude JCL and LOG4J since we want all logging to go through SLF4J. Note that we're excluding
                 log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar
               - Exclude legacy modules if the legacy profile is not enabled so that we don't have both aspectified JAR
                 and non aspectified ones
               - Exclude batik-js to prevent conflict with the patched version of Rhino used by yuicompressor used for
                 JSX. See http://jira.xwiki.org/jira/browse/XWIKI-6151 for more details.
               - Exclude JavaBeans Activation Framework (activation-*.jar) since it's included in Java SE 6.
          -->
          <packagingExcludes>
            WEB-INF/lib/activation-*.jar,
            WEB-INF/lib/batik-js-*.jar,
            WEB-INF/lib/commons-logging-*.jar,
            resources/js/xwiki/wysiwyg/**
          </packagingExcludes>
          <overlays>
            <overlay>
              <groupId>${project.groupId}</groupId>
              <artifactId>pedigree-editor</artifactId>
              <type>jar</type>
              <targetPath>resources/uicomponents/</targetPath>
            </overlay>
            <overlay>
              <groupId>org.xwiki.platform</groupId>
              <artifactId>xwiki-platform-colibri</artifactId>
              <type>zip</type>
              <targetPath>skins/</targetPath>
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
