<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>
    <groupId>org.dspace.modules</groupId>
    <artifactId>xmlui</artifactId>
    <packaging>war</packaging>
    <name>DSpace XML-UI (Manakin) :: Local Customizations</name>
    <description>
        This project allows you to overlay your own local XML-UI customizations
        on top of the default XML-UI web application provided with DSpace.
    </description>

    <parent>
        <groupId>org.dspace</groupId>
        <artifactId>modules</artifactId>
        <version>6.3</version>
        <relativePath>..</relativePath>
    </parent>

    <properties>
        <!-- This is the path to the root [dspace-src] directory. -->
        <root.basedir>${basedir}/../../..</root.basedir>
    </properties>

    <build>
        <plugins>
            <!-- Unpack the "additions" module into our target directory,
                 so that any custom classes in that module can be included
                 into this WAR's WEB-INF/classes (see maven-war-plugin below). -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>org.dspace.modules</includeGroupIds>
                            <includeArtifactIds>additions</includeArtifactIds>
                            <!--NOTE: by default this will also unpack transitive dependencies. To disable, uncomment this next line:
                            <excludeTransitive>true</excludeTransitive>
                            -->
                            <outputDirectory>${project.build.directory}/additions</outputDirectory>
                            <excludes>META-INF/**</excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>oracle-support</id>
            <activation>
                <property>
                    <name>db.name</name>
                    <value>oracle</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>default-war</id>
            <activation>
                <property>
                    <name>!mirage2.on</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <archiveClasses>false</archiveClasses>
                            <!-- Filter the web.xml (needed for IDE compatibility/debugging) -->
                            <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                            <!-- Copy any 'additions' (see m-dependency-p above) into WEB-INF/classes.
                                 This ensures they are loaded prior to dependencies in WEB-INF/lib
                                (per Servlet 3.0 spec, section 10.5), and allows them to override
                                 default classes in this WAR -->
                            <webResources>
                                <resource>
                                    <directory>${project.build.directory}/additions</directory>
                                    <targetPath>WEB-INF/classes</targetPath>
                                </resource>
                            </webResources>
                            <overlays>
                                <!--
                                   the priority of overlays is determined here
                                   1.) default: anything in the current project has highest
                                   2.) anything defined here has precedence in the order defined
                                   3.) any war found transitively in the dependencies will be applied
                                   next. the order is unpredictable.
                                -->
                                <overlay>
                                    <groupId>org.dspace</groupId>
                                    <artifactId>dspace-xmlui-lang</artifactId>
                                    <type>war</type>
                                    <excludes>
                                        <!--
                                           keep lang web.xml from overiding xmlui
                                        -->
                                        <exclude>WEB-INF/web.xml</exclude>
                                        <exclude>WEB-INF/classes/**</exclude>
                                    </excludes>
                                </overlay>
                                <overlay>
                                    <groupId>org.dspace</groupId>
                                    <artifactId>dspace-xmlui</artifactId>
                                    <type>war</type>
                                    <excludes>
                                        <exclude>WEB-INF/classes/**</exclude>
                                    </excludes>
                                </overlay>
                            </overlays>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
        <profile>
            <id>mirage2-war</id>
            <activation>
                <property>
                    <name>mirage2.on</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <archiveClasses>false</archiveClasses>
                            <!-- Filter the web.xml (needed for IDE compatibility/debugging) -->
                            <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                            <!-- Copy any 'additions' (see m-dependency-p above) into WEB-INF/classes.
                                 This ensures they are loaded prior to dependencies in WEB-INF/lib
                                (per Servlet 3.0 spec, section 10.5), and allows them to override
                                 default classes in this WAR -->
                            <webResources>
                                <resource>
                                    <directory>${project.build.directory}/additions</directory>
                                    <targetPath>WEB-INF/classes</targetPath>
                                </resource>
                            </webResources>
                            <overlays>
                                <!--
                                   the priority of overlays is determined here
                                   1.) default: anything in the current project has highest
                                   2.) anything defined here has precedence in the order defined
                                   3.) any war found transitively in the dependencies will be applied
                                   next. the order is unpredictable.
                                -->
                                <overlay>
                                    <groupId>org.dspace.modules</groupId>
                                    <artifactId>xmlui-mirage2</artifactId>
                                    <type>war</type>
                                </overlay>
                                <overlay>
                                    <groupId>org.dspace</groupId>
                                    <artifactId>dspace-xmlui-lang</artifactId>
                                    <type>war</type>
                                    <excludes>
                                        <!--
                                           keep lang web.xml from overiding xmlui
                                        -->
                                        <exclude>WEB-INF/web.xml</exclude>
                                        <exclude>WEB-INF/classes/**</exclude>
                                    </excludes>
                                </overlay>
                                <overlay>
                                    <groupId>org.dspace</groupId>
                                    <artifactId>dspace-xmlui</artifactId>
                                    <type>war</type>
                                    <excludes>
                                        <exclude>WEB-INF/classes/**</exclude>
                                    </excludes>
                                </overlay>
                            </overlays>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.dspace.modules</groupId>
                    <artifactId>xmlui-mirage2</artifactId>
                    <version>6.3</version>
                    <type>war</type>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>

        <dependency>
            <groupId>org.dspace.modules</groupId>
            <artifactId>additions</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- DSpace XMLUI Languages -->
        <dependency>
            <groupId>org.dspace</groupId>
            <artifactId>dspace-xmlui-lang</artifactId>
            <type>war</type>
        </dependency>

        <!-- DSpace XMLUI Webapp -->
        <dependency>
            <groupId>org.dspace</groupId>
            <artifactId>dspace-xmlui</artifactId>
            <type>war</type>
        </dependency>

        <!-- DSpace XMLUI API -->
        <dependency>
            <groupId>org.dspace</groupId>
            <artifactId>dspace-xmlui</artifactId>
            <type>jar</type>
            <classifier>classes</classifier>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>

</project>
