<?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.phenotips</groupId>
    <artifactId>phenotips-distribution</artifactId>
    <version>1.0-milestone-8</version>
  </parent>
  <artifactId>phenotips-war</artifactId>
  <name>PhenoTips - War package</name>
  <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 />

    <!-- XWiki Enterprise Manager embeds XWiki Enterprise -->
    <xwiki.extension.features>org.xwiki.enterprise:xwiki-enterprise-web</xwiki.extension.features>

    <!-- The default UI associated to this WAR -->
    <xwiki.extension.distribution.ui>org.phenotips:phenotips-ui</xwiki.extension.distribution.ui>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.xwiki.enterprise</groupId>
      <artifactId>xwiki-enterprise-web</artifactId>
      <version>${xwiki.version}</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>component-registry</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>solr-access-service</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>ontology-access</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpcore</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-data-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-data-migrations</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-data-indexing</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-measurements-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-measurements-migrations</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>application-configuration-migrations</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-tools</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>ncbieutils-services-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>phenotype-mapping-service</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-update-listeners</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>obo2solr</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-similarity-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>patient-similarity-search</artifactId>
      <version>${project.version}</version>
    </dependency>
    <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.2.9</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.24</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.0.11</version>
    </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</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>
                <xwikiDbHbmCommonExtraMappings>activitystream.hbm.xml</xwikiDbHbmCommonExtraMappings>
                <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.feed.FeedPlugin,\
  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.lucene.LucenePlugin,\
  com.xpn.xwiki.plugin.diff.DiffPlugin,\
  com.xpn.xwiki.plugin.rightsmanager.RightsManagerPlugin,\
  com.xpn.xwiki.plugin.jodatime.JodaTimePlugin,\
  com.xpn.xwiki.plugin.scheduler.SchedulerPlugin,\
  com.xpn.xwiki.plugin.mailsender.MailSenderPlugin,\
  com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPlugin, \
  com.xpn.xwiki.plugin.watchlist.WatchListPlugin, \
  com.xpn.xwiki.plugin.tag.TagPlugin</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.section.edit=0
xwiki.backlinks=0
xwiki.showviewaction=0
xwiki.defaultweb=data
xwiki.usedefaultweb=1
xwiki.usedefaultaction=0
xwiki.monitor=0
                </xwikiCfgAdditionalProperties>
                <xwikiPropertiesEnvironmentPermanentDirectory>/var/lib/phenotips/</xwikiPropertiesEnvironmentPermanentDirectory>
                <xwikiPropertiesAdditionalProperties>
model.reference.default.space=data
extension.repositories=maven-xwiki:maven:http://nexus.xwiki.org/nexus/content/groups/public
extension.repositories=maven-phenotips:maven:http://nexus.cs.toronto.edu/nexus/content/repositories/releases/
extension.repositories=extensions.xwiki.org:xwiki:http://extensions.xwiki.org/xwiki/rest/
                </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/xwiki-commons-component-api-*.jar,
            WEB-INF/lib/xwiki-commons-component-default-*.jar,
            WEB-INF/lib/xwiki-rendering-api-*.jar,
            WEB-INF/lib/xwiki-platform-oldcore-*.jar,
            WEB-INF/lib/xwiki-platform-office-importer-*.jar,
            WEB-INF/lib/batik-js-*.jar,
            WEB-INF/lib/commons-logging-*.jar,
            %regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar],
            WEB-INF/lib/activation-*.jar,
            WEB-INF/lib/commons-lang-2.5.jar,
            WEB-INF/lib/asm-3.1.jar,
            WEB-INF/lib/guava-12.0.jar,
            WEB-INF/lib/jdom-1.0.jar,
            WEB-INF/lib/jdom-1.1.jar,
            WEB-INF/lib/log4j-over-slf4j-1.7.2.jar,
            WEB-INF/lib/logback-classic-1.0.9.jar,
            WEB-INF/lib/logback-core-1.0.9.jar,
            WEB-INF/lib/plexus-utils-2.0.6.jar,
            WEB-INF/lib/rome-0.9.jar,
            WEB-INF/lib/slf4j-api-1.7.2.jar,
            WEB-INF/lib/woodstox-core-asl-4.1.1.jar,
            WEB-INF/lib/xercesImpl-2.10.0.jar
          </packagingExcludes>
          <overlays>
            <overlay>
              <groupId>${project.groupId}</groupId>
              <artifactId>pedigree-editor</artifactId>
              <type>jar</type>
              <targetPath>resources/uicomponents/</targetPath>
            </overlay>
          </overlays>
        </configuration>
      </plugin>
      <!-- Ensure that some modules are not added as dependencies. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-banned-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <excludes>
                    <exclude>org.jmock:*</exclude>
                    <exclude>junit:*</exclude>
                    <exclude>javax.servlet:servlet-api:*:*:compile</exclude>
                  </excludes>
                  <includes>
                    <!-- Allow only JUnit and JMock with scope test because -->
                    <include>org.jmock:*:*:*:test</include>
                    <include>junit:*:*:*:test</include>
                  </includes>
                </bannedDependencies>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
