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

    eXist-db Open Source Native XML Database
    Copyright (C) 2001 The eXist-db Authors

    info@exist-db.org
    http://www.exist-db.org

    This library 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 library 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 library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

-->
<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.exist-db</groupId>
        <artifactId>exist-parent</artifactId>
        <version>5.3.1</version>
        <relativePath>../exist-parent</relativePath>
    </parent>

    <artifactId>exist-distribution</artifactId>
    <packaging>pom</packaging>

    <name>eXist-db Distributions</name>
    <description>Distributions for eXist-db NoSQL Database Client/Server</description>

    <scm>
        <connection>scm:git:https://github.com/exist-db/exist.git</connection>
        <developerConnection>scm:git:https://github.com/exist-db/exist.git</developerConnection>
        <url>scm:git:https://github.com/exist-db/exist.git</url>
      <tag>eXist-5.3.1</tag>
  </scm>

    <properties>
        <appassembler.version>2.1.0</appassembler.version>
        <assemble.dir>${project.build.directory}/${project.artifactId}-${project.version}-dir</assemble.dir>
        <public.xar.repo.uri>http://exist-db.org/exist/apps/public-repo</public.xar.repo.uri>
        <expath.pkg.dir>${project.build.directory}/expath-pkgs</expath.pkg.dir>
        <mac.bundle.dir>${project.build.directory}/${project.artifactId}-${project.version}.app</mac.bundle.dir>
        <mac.bundle.resources.dir>${mac.bundle.dir}/Contents/Resources</mac.bundle.resources.dir>
        <mac.dmg>${project.build.directory}/eXist-db-${project.version}.dmg</mac.dmg>
        <mac.codesign.identity>Developer ID Application: Evolved Binary Ltd</mac.codesign.identity>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-core</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-start</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-service</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- extensions/ -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-contentextraction</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-exiftool</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-expath</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-exquery-request-module</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-restxq</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-webdav</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-xqdoc</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>


        <!-- extensions/indexes/ -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-index-lucene</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-index-ngram</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-index-range</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-index-sort</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-index-spatial</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- extensions/modules/ -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-cache</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-compression</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-counter</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-cqlparser</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- TODO(AR) EXI module is effectively GPL -->
        <!-- dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-exi</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-expathrepo</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-file</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-image</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-jndi</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-mail</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-persistentlogin</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-process</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-scheduler</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-simpleql</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-sql</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-xmldiff</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-xslfo</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- extensions/security/ -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-security-activedirectory</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-security-iprange</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>exist-security-ldap</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- needed for starting up a jetty server -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-deploy</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jmx</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-server</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- server-side dependency for javax.websocket (JSR-356) support -->
        <dependency>
          <groupId>org.eclipse.jetty.websocket</groupId>
          <artifactId>javax-websocket-server-impl</artifactId>
          <scope>runtime</scope>
        </dependency>

        <!-- needed for the AppAssembler booter approach -->
        <dependency>
            <groupId>org.codehaus.mojo.appassembler</groupId>
            <artifactId>appassembler-booter</artifactId>
            <version>${appassembler.version}</version>
            <scope>runtime</scope>
        </dependency>

    </dependencies>

    <build>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <!--
                                eXist-db's License
                            -->
                            <header>${project.parent.relativePath}/LGPL-21-license.template.txt</header>
                            <excludes>
                                <exclude>LGPL-21-license.txt</exclude>
                                <exclude>src/appbundler/**</exclude>
                                <exclude>src/dmg/**</exclude>
                                <exclude>src/main/config/**</exclude>  <!-- config files shipped with eXist-db don't need copyright headers -->
                                <exclude>src/main/xslt/configure_9_3.dtd</exclude>
                                <exclude>src/main/xslt/web-app_3_1.xsd</exclude>
                                <exclude>src/main/xslt/javaee_web_services_client_1_4.xsd</exclude>
                                <exclude>src/main/xslt/jsp_2_3.xsd</exclude>
                                <exclude>src/main/xslt/xml.xsd</exclude>
                                <exclude>src/main/xslt/web-common_3_1.xsd</exclude>
                                <exclude>src/main/xslt/javaee_7.xsd</exclude>
                            </excludes>
                        </licenseSet>
                    </licenseSets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>analyze</id>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <ignoreNonCompile>true</ignoreNonCompile>
                        </configuration>
                    </execution>

                    <execution>
                        <id>unpack-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <markersDirectory>${project.build.directory}/dependency-maven-plugin-markers/appassembler</markersDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>exist-jetty-config</artifactId>
                                    <version>${project.version}</version>
                                    <excludes>META-INF/</excludes>
                                    <outputDirectory>${assemble.dir}/etc</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>exist-service</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>native-unix</classifier>
                                    <type>tar.bz2</type>
                                    <outputDirectory>${assemble.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>exist-service</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>native-win</classifier>
                                    <type>zip</type>
                                    <outputDirectory>${assemble.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>

                    <execution>
                        <id>unpack-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <markersDirectory>${project.build.directory}/dependency-maven-plugin-markers/macbundle</markersDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>exist-jetty-config</artifactId>
                                    <version>${project.version}</version>
                                    <excludes>META-INF/</excludes>
                                    <outputDirectory>${mac.bundle.resources.dir}/etc</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>

                </executions>
            </plugin>

            <plugin>
                <groupId>com.github.monkeywie</groupId>
                <artifactId>copy-rename-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>rename-jetty-etc-dir-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>rename</goal>
                        </goals>
                        <configuration>
                            <sourceFile>${assemble.dir}/etc/org/exist/jetty/etc</sourceFile>
                            <destinationFile>${assemble.dir}/etc/jetty</destinationFile>
                            <ignoreFileNotFoundOnIncremental>true</ignoreFileNotFoundOnIncremental>
                        </configuration>
                    </execution>

                    <execution>
                        <id>rename-jetty-etc-dir-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>rename</goal>
                        </goals>
                        <configuration>
                            <sourceFile>${mac.bundle.resources.dir}/etc/org/exist/jetty/etc</sourceFile>
                            <destinationFile>${mac.bundle.resources.dir}/etc/jetty</destinationFile>
                            <ignoreFileNotFoundOnIncremental>true</ignoreFileNotFoundOnIncremental>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-readme-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../LICENSE</sourceFile>
                                    <destinationFile>${assemble.dir}/LICENSE</destinationFile>
                                </fileSet>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../README.md</sourceFile>
                                    <destinationFile>${assemble.dir}/README.md</destinationFile>
                                </fileSet>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../CONTRIBUTING.md</sourceFile>
                                    <destinationFile>${assemble.dir}/CONTRIBUTING.md</destinationFile>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-readme-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../LICENSE</sourceFile>
                                    <destinationFile>${mac.bundle.resources.dir}/LICENSE</destinationFile>
                                </fileSet>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../README.md</sourceFile>
                                    <destinationFile>${mac.bundle.resources.dir}/README.md</destinationFile>
                                </fileSet>
                                <fileSet>
                                    <sourceFile>${project.basedir}/../CONTRIBUTING.md</sourceFile>
                                    <destinationFile>${mac.bundle.resources.dir}/CONTRIBUTING.md</destinationFile>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <configuration>
                    <catalogHandling>local</catalogHandling>
                    <catalogs>
                        <catalog>src/main/xslt/catalog.xml</catalog>
                    </catalogs>
                </configuration>
                <executions>
                    <execution>
                        <id>adjust-jetty-deploy-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <dir>${assemble.dir}/etc/jetty</dir>
                                    <includes>
                                        <include>jetty-deploy.xml</include>
                                        <include>webapps/exist-webapp-context.xml</include>
                                        <include>standalone-jetty-deploy.xml</include>
                                        <include>standalone-webapps/exist-webapp-context.xml</include>
                                        <include>jetty-ssl-context.xml</include>
                                    </includes>
                                    <stylesheet>src/main/xslt/jetty-deploy.xslt</stylesheet>
                                    <outputDir>${assemble.dir}/etc/jetty</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>adjust-web-xml-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <dir>${assemble.dir}/etc/webapp/WEB-INF</dir>
                                    <includes>
                                        <include>web.xml</include>
                                    </includes>
                                    <stylesheet>src/main/xslt/web.xslt</stylesheet>
                                    <outputDir>${assemble.dir}/etc/webapp/WEB-INF</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>adjust-jetty-deploy-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <dir>${mac.bundle.resources.dir}/etc/jetty</dir>
                                    <includes>
                                        <include>jetty-deploy.xml</include>
                                        <include>webapps/exist-webapp-context.xml</include>
                                        <include>standalone-jetty-deploy.xml</include>
                                        <include>standalone-webapps/exist-webapp-context.xml</include>
                                        <include>jetty-ssl-context.xml</include>
                                    </includes>
                                    <stylesheet>src/main/xslt/jetty-deploy.xslt</stylesheet>
                                    <outputDir>${mac.bundle.resources.dir}/etc/jetty</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>adjust-web-xml-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <dir>${mac.bundle.resources.dir}/etc/webapp/WEB-INF</dir>
                                    <includes>
                                        <include>web.xml</include>
                                    </includes>
                                    <stylesheet>src/main/xslt/web.xslt</stylesheet>
                                    <outputDir>${mac.bundle.resources.dir}/etc/webapp/WEB-INF</outputDir>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>clean-etc-dir-unpacked-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${assemble.dir}/etc/org</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>clean-etc-dir-unpacked-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${mac.bundle.resources.dir}/etc/org</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.exist-db.maven.plugins</groupId>
                <artifactId>public-xar-repo-plugin</artifactId>
                <version>1.2.0</version>
                <executions>
                    <execution>
                        <id>fetch-xars</id>
                        <phase>package</phase>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                        <configuration>
                            <repoUri>${public.xar.repo.uri}</repoUri>
                            <outputDirectory>${expath.pkg.dir}</outputDirectory>
                            <existDbVersion>${project.version}</existDbVersion>
                            <packages>
                                <package>
                                    <abbrev>dashboard</abbrev>
                                </package>
                                <package>
                                    <abbrev>eXide</abbrev>
                                </package>
                                <package>
                                    <abbrev>exist-documentation</abbrev>
                                </package>
                                <package>
                                    <abbrev>functx</abbrev>
                                </package>
                                <package>
                                    <abbrev>fundocs</abbrev>
                                </package>
                                <package>
                                    <abbrev>monex</abbrev>
                                </package>
                                <package>
                                    <abbrev>packageservice</abbrev>
                                </package>
                                <package>
                                    <abbrev>semver-xq</abbrev>
                                </package>
                                <package>
                                    <abbrev>templating</abbrev>
                                </package>
                            </packages>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>ch.mfrey.maven.plugin</groupId>
                <artifactId>copy-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <showfiles>true</showfiles>
                </configuration>
                <executions>
                    <execution>
                        <id>autodeploy-expath-pkgs-for-appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <workOnFullPath>true</workOnFullPath>
                                    <directory>${expath.pkg.dir}</directory>
                                    <includes>*.xar</includes>
                                    <paths>
                                        <path>
                                            <from>${expath.pkg.dir}</from>
                                            <to>${assemble.dir}/autodeploy</to>
                                        </path>
                                    </paths>
                                    <replaceExisting>true</replaceExisting>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>autodeploy-expath-pkgs-for-mac-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory />  <!-- NOTE: this must be empty -->
                            <resources>
                                <resource>
                                    <workOnFullPath>true</workOnFullPath>
                                    <directory>${expath.pkg.dir}</directory>
                                    <includes>*.xar</includes>
                                    <path>
                                        <from>${expath.pkg.dir}</from>
                                        <to>${mac.bundle.resources.dir}/autodeploy</to>
                                    </path>
                                    <replaceExisting>true</replaceExisting>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>${appassembler.version}</version>
                <configuration>
                    <repositoryLayout>flat</repositoryLayout>
                    <repositoryName>lib</repositoryName>
                    <binFileExtensions>
                        <unix>.sh</unix>
                    </binFileExtensions>
                    <defaultJvmSettings>
                        <initialMemorySize>128m</initialMemorySize>

                        <!-- Option to generate JDWP debuggable app -->
                        <!-- extraArguments>
                            <extraArgument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</extraArgument>
                        </extraArguments -->

                        <systemProperties>
                            <systemProperty>file.encoding=UTF-8</systemProperty>
                            <systemProperty>log4j.configurationFile=@BASEDIR@/etc/log4j2.xml</systemProperty>
                            <systemProperty>exist.home=@BASEDIR@</systemProperty>
                            <systemProperty>exist.configurationFile=@BASEDIR@/etc/conf.xml</systemProperty>
                            <systemProperty>jetty.home=@BASEDIR@</systemProperty>
                            <systemProperty>exist.jetty.config=@BASEDIR@/etc/jetty/standard.enabled-jetty-configs</systemProperty>
                        </systemProperties>
                    </defaultJvmSettings>
                    <licenseHeaderFile>LGPL-21-license.txt</licenseHeaderFile>
                </configuration>
                <executions>
                    <execution>
                        <id>appassembler-base</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                        <configuration>
                            <assembleDirectory>${assemble.dir}</assembleDirectory>
                            <programs />
                            <configurationDirectory>etc</configurationDirectory>
                            <copyConfigurationDirectory>true</copyConfigurationDirectory>
                            <logsDirectory>logs</logsDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>appassembler-booter</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate-daemons</goal>
                        </goals>
                        <configuration>
                            <generateRepository>false</generateRepository>
                            <target>${assemble.dir}</target>
                            <separateTargetPlatforms>false</separateTargetPlatforms>
                            <daemons>
                                <daemon>
                                    <id>client</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>client</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>startup</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>jetty</commandLineArgument>
                                        <commandLineArgument>@BASEDIR@/etc/conf.xml</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>shutdown</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>shutdown</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>launcher</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <!-- No arguments needed! Default is to start the launcher -->
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>backup</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>backup</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>export</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.backup.ExportMain</commandLineArgument>
                                        <commandLineArgument>--export</commandLineArgument>
                                        <commandLineArgument>--zip</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>export-gui</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.backup.ExportGUI</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>jmxclient</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.management.client.JMXClient</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                        <platform>booter-windows</platform>
                                    </platforms>
                                </daemon>
                            </daemons>
                        </configuration>

                    </execution>

                    <execution>
                        <id>appassembler-booter-for-mac</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate-daemons</goal>
                        </goals>
                        <configuration>
                            <repositoryName>../Java</repositoryName>
                            <generateRepository>false</generateRepository>
                            <target>${mac.bundle.resources.dir}</target>
                            <separateTargetPlatforms>false</separateTargetPlatforms>
                            <daemons>
                                <daemon>
                                    <id>client</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>client</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>startup</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>jetty</commandLineArgument>
                                        <commandLineArgument>@BASEDIR@/etc/conf.xml</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>shutdown</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>shutdown</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>launcher</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <!-- No arguments needed! Default is to start the launcher -->
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>backup</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>backup</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>export</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.backup.ExportMain</commandLineArgument>
                                        <commandLineArgument>--export</commandLineArgument>
                                        <commandLineArgument>--zip</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>export-gui</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.backup.ExportGUI</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                                <daemon>
                                    <id>jmxclient</id>
                                    <mainClass>org.exist.start.Main</mainClass>
                                    <commandLineArguments>
                                        <commandLineArgument>org.exist.management.client.JMXClient</commandLineArgument>
                                    </commandLineArguments>
                                    <platforms>
                                        <platform>booter-unix</platform>
                                    </platforms>
                                </daemon>
                            </daemons>
                        </configuration>

                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble-archives</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skipAssembly>false</skipAssembly>  <!-- Can be overridden by profile skip-build-dist-archives -->
                    <attach>false</attach>
                    <tarLongFileMode>gnu</tarLongFileMode>
                    <descriptors>
                        <descriptor>src/assembly/dist-assembly-unix.xml</descriptor>
                        <descriptor>src/assembly/dist-assembly-win.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.evolvedbinary.appbundler</groupId>
                <artifactId>appbundler-maven-plugin</artifactId>
                <version>1.0.7</version>
                <executions>
                    <execution>
                        <id>exist-db-mac-app</id>
                        <phase>package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                        <configuration>
                            <displayName>eXist-db</displayName>
                            <identifier>org.exist.start.Main</identifier>
                            <mainClassName>org.exist.start.Main</mainClassName>
                            <executableName>eXist-JavaAppLauncher</executableName>
                            <jvmRequired>1.8</jvmRequired>
                            <minimumSystemVersion>10.9</minimumSystemVersion>
                            <version>${project.version}</version>
                            <shortVersion>${project.version}</shortVersion>
                            <icon>icon.icns</icon>
                            <copyright>${project.inceptionYear} The eXist-db Project</copyright>
                            <applicationCategory>public.app-category.developer-tools</applicationCategory>
                            <additionalResourcePaths>
                                <fileSet>
                                    <directory>${project.basedir}/src/main/config</directory>
                                    <outputDirectory>etc</outputDirectory>
                                </fileSet>
                            </additionalResourcePaths>
                            <options>
                                <!-- Option to generate JDWP debuggable App Bundle -->
                                <!-- option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</option -->

                                <!-- Option to cause org.exist.launcher.Launcher to wait for JDWP on port 5006 -->
                                <!-- option>-Dexist.debug.launcher=true</option -->

                                <option>-Xms128m</option>
                                <option>-Dfile.encoding=UTF-8</option>
                                <option>-Dlog4j.configurationFile=$APP_ROOT/Contents/Resources/etc/log4j2.xml</option>
                                <option>-Dapp.repo=$APP_ROOT/Contents/Java</option>
                                <option>-Dexist.home=$APP_ROOT/Contents/Resources</option>
                                <option>-Dexist.configurationFile=$APP_ROOT/Contents/Resources/etc/conf.xml</option>
                                <option>-Djetty.home=$APP_ROOT/Contents/Resources</option>
                                <option>-Dexist.jetty.config=$APP_ROOT/Contents/Resources/etc/jetty/standard.enabled-jetty-configs</option>
                                <option>-Xdock:name=eXist-db</option>
                                <option>-Dapple.laf.useScreenMenuBar=true</option>
                            </options>
                            <explicitClassPath>false</explicitClassPath>
                            <isDebug>true</isDebug>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>skip-build-dist-archives</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <skipAssembly>true</skipAssembly>  <!-- Override setting in default profile build/plugins for this module -->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>codesign-mac-app</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
                <property>
                    <name>mac-signing</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>mac-codesign-app</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>/usr/bin/codesign</executable>
                                    <arguments>
                                        <argument>--force</argument>
                                        <argument>--sign</argument>
                                        <argument>${mac.codesign.identity}</argument>
                                        <argument>${mac.bundle.dir}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>mac-dmg-on-mac</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
                <!-- Note: Travis Mac doesn't support the hdiutil attach required by create-dmg-mac.sh -->
                <property>
                    <name>env.CI</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>mac-app-dmg-on-mac</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${project.basedir}/src/main/scripts/create-dmg-mac.sh</executable>
                                    <arguments>
                                        <argument>${mac.bundle.dir}</argument>
                                        <argument>eXist-db</argument>
                                        <argument>${project.basedir}/src/dmg/background.png</argument>
                                        <argument>${project.basedir}/src/dmg/VolumeIcon.icns</argument>
                                        <argument>${project.basedir}/src/dmg/App_DS_Store</argument>
                                        <argument>${mac.dmg}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>mac-dmg-on-unix</id>
            <activation>
                <os>
                    <family>unix</family>
                    <name>Linux</name>
                </os>
                <!-- Note: Travis and AppVeyor etc don't support the loopback filesystem required by create-dmg-unix.sh -->
                <property>
                    <name>env.CI</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>mac-app-dmg-on-unix</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${project.basedir}/src/main/scripts/create-dmg-unix.sh</executable>
                                    <arguments>
                                        <argument>${mac.bundle.dir}</argument>
                                        <argument>eXist-db</argument>
                                        <argument>${project.basedir}/src/dmg/background.png</argument>
                                        <argument>${project.basedir}/src/dmg/VolumeIcon.icns</argument>
                                        <argument>${project.basedir}/src/dmg/App_DS_Store</argument>
                                        <argument>${mac.dmg}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>codesign-mac-dmg</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
                <property>
                    <name>mac-signing</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>mac-codesign-dmg</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>/usr/bin/codesign</executable>
                                    <arguments>
                                        <argument>--force</argument>
                                        <argument>--sign</argument>
                                        <argument>${mac.codesign.identity}</argument>
                                        <argument>${mac.dmg}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- NOTE: this is activated by the maven-release-plugin -->
            <id>exist-release</id>
            <build>
                <plugins>
                    <!-- This is needed in a profile to workaround https://github.com/jutzig/github-release-plugin/issues/50 -->
                    <plugin>
                        <groupId>de.jutzig</groupId>
                        <artifactId>github-release-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>github-upload</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>release</goal>
                                </goals>
                                <inherited>false</inherited>
                                <configuration>
                                    <description>
                                        Release Notes: https://exist-db.org/exist/apps/wiki/blogs/eXist/exist${project.version}

                                        Maven Central: https://search.maven.org/search?q=g:org.exist-db
                                    </description>
                                    <releaseName>eXist-db ${project.version}</releaseName>
                                    <tag>eXist-${project.version}</tag>
                                    <fileSets>
                                        <fileSet>
                                            <directory>${project.build.directory}</directory>
                                            <includes>
                                                <include>eXist-db-${project.version}.dmg</include>
                                                <include>${project.artifactId}-${project.version}-unix.tar.bz2</include>
                                                <include>${project.artifactId}-${project.version}-win.zip</include>
                                            </includes>
                                        </fileSet>
                                    </fileSets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
