<?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>edu.toronto.cs.phenotips</groupId>
    <artifactId>phenotips-distribution</artifactId>
    <version>1.0-milestone-2</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>edu.toronto.cs.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>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>patient-tools</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>ncbieutils-access-service</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>pedigree-editor</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </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>
        </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>
              </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
          </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>
