<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership. The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<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.apache.james</groupId>
        <artifactId>james-server</artifactId>
        <version>3.9.0-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <artifactId>james-server-spring-app</artifactId>
    <packaging>jar</packaging>

    <name>Apache James :: Server :: Spring :: App</name>
    <description>An advanced email server / Spring version</description>

    <properties>

        <!-- For more details see -->
        <!-- http://java.sun.com/products/javamail/javadocs/javax/mail/internet/package-summary.html -->
        <javamail.system-property1>-Dmail.mime.multipart.ignoremissingendboundary=true</javamail.system-property1>
        <javamail.system-property2>-Dmail.mime.multipart.ignoremissingboundaryparameter=true</javamail.system-property2>
        <javamail.system-property3>-Dmail.mime.ignoreunknownencoding=true</javamail.system-property3>
        <javamail.system-property4>-Dmail.mime.uudecode.ignoreerrors=true</javamail.system-property4>
        <javamail.system-property5>-Dmail.mime.uudecode.ignoremissingbeginend=true</javamail.system-property5>
        <javamail.system-property6>-Dmail.mime.multipart.allowempty=true</javamail.system-property6>
        <javamail.system-property7>-Dmail.mime.base64.ignoreerrors=true</javamail.system-property7>
        <javamail.system-property8>-Dmail.mime.encodeparameters=true</javamail.system-property8>
        <javamail.system-property9>-Dmail.mime.decodeparameters=true</javamail.system-property9>
        <javamail.system-property10>-Dmail.mime.address.strict=false</javamail.system-property10>
        <javamail.system-property11>-Djmx.remote.x.mlet.allow.getMBeansFromURL=false</javamail.system-property11>
        <javamail.system-property12>-Djames.jmx.unregister.log4j.mbeans=true</javamail.system-property12>
        <javamail.system-properties>${javamail.system-property1} ${javamail.system-property2}
            ${javamail.system-property3} ${javamail.system-property4} ${javamail.system-property5}
            ${javamail.system-property6} ${javamail.system-property7} ${javamail.system-property8}
            ${javamail.system-property9} ${javamail.system-property10} ${javamail.system-property11}
            ${javamail.system-property12}
        </javamail.system-properties>

        <!-- JMX system properties -->
        <!-- For more details see -->
        <!-- http://download.oracle.com/javase/1.5.0/docs/guide/management/agent.html -->
        <jmx.system-property1>-Dcom.sun.management.jmxremote=true</jmx.system-property1>
        <jmx.system-property2>-Dcom.sun.management.jmxremote.authenticate=false</jmx.system-property2>
        <jmx.system-properties>${jmx.system-property1} ${jmx.system-property2}</jmx.system-properties>

        <jvm.system-property1>-XX:+HeapDumpOnOutOfMemoryError</jvm.system-property1>

        <!-- Use filesystem to copy message by default -->
        <james.system-property1>-Djames.message.usememorycopy=false</james.system-property1>
        <!-- Prevents Logjam (CVE-2015-4000) -->
        <james.system-property2>-Djdk.tls.ephemeralDHKeySize=2048</james.system-property2>
        <james.system-property3>-Dopenjpa.Multithreaded=true</james.system-property3>
        <james.system-properties>${james.system-property1} ${james.system-property2} ${james.system-property3}</james.system-properties>
        <!-- this name is used for James's folders on Debian systems and james user -->
        <james.debian.user>apache-james</james.debian.user>

    </properties>

    <dependencies>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>apache-james-mailbox-jpa</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>apache-james-mailbox-lucene</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>apache-james-mailbox-memory</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>apache-james-mailbox-spring</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.hadoop</groupId>
                    <artifactId>hadoop-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-cli</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-data-api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-data-file</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-data-jpa</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-data-ldap</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-data-library</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-dnsservice-api</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-dnsservice-dnsjava</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-dnsservice-library</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-fetchmail</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-filesystem-api</artifactId>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-lifecycle-api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-mailbox-adapter</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-mailet-dkim</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-mailetcontainer-api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-mailetcontainer-impl</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-mailets</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-imap4</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-library</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-lmtp</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-managesieve</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-pop3</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-protocols-smtp</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-queue-activemq</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-queue-api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-queue-jms</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-spring</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-task-memory</artifactId>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>james-server-util</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.angus</groupId>
                    <artifactId>jakarta.mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>metrics-api</artifactId>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>metrics-dropwizard</artifactId>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>metrics-logger</artifactId>
        </dependency>
        <dependency>
            <groupId>${james.groupId}</groupId>
            <artifactId>testing-base</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>${james.protocols.groupId}</groupId>
            <artifactId>protocols-imap</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>${james.protocols.groupId}</groupId>
            <artifactId>protocols-managesieve</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-daemon</groupId>
            <artifactId>commons-daemon</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- Runtime dependencies which will get included in the generated binary distribution -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>2.1.0</version>
                <configuration>
                    <!-- Include etc/ in the beginning of the classpath declaration in the bin scripts -->
                    <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
                    <configurationDirectory>conf</configurationDirectory>
                    <target>${project.build.directory}/appassembler</target>
                    <repositoryLayout>flat</repositoryLayout>
                    <repositoryName>lib</repositoryName>
                    <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
                    <environmentSetupFileName>setenv</environmentSetupFileName>
                    <!-- set some sane defaults for memory -->
                    <extraJvmArguments>${jvm.system-property1} -Xms128m -Xmx512m ${jmx.system-properties}
                        ${javamail.system-properties} ${james.system-properties}</extraJvmArguments>
                    <!-- Generate bin scripts for windows and unix per default -->
                    <platforms>
                        <platform>windows</platform>
                        <platform>unix</platform>
                    </platforms>
                    <!-- use .sh on unix instead of .bin -->
                    <binFileExtensions>
                        <unix>.sh</unix>
                    </binFileExtensions>
                    <!-- use *.jar instead of every single jar file in classpath -->
                    <useWildcardClassPath>true</useWildcardClassPath>
                    <repositoryLayout>flat</repositoryLayout>
                    <programs>
                        <program>
                            <mainClass>org.apache.james.app.spring.JamesAppSpringMain</mainClass>
                            <!-- call it only "run" because appassemble will add the extension -->
                            <name>run</name>
                            <!-- Only generate windows bat script and unix sh for this application -->
                            <platforms>
                                <platform>windows</platform>
                                <platform>unix</platform>
                            </platforms>
                        </program>

                        <!-- This create the scripts for the command line administration client. Maybe this should better be moved to the cli module, but I'm not sure yet -->
                        <program>
                            <mainClass>org.apache.james.cli.ServerCmd</mainClass>
                            <!-- call it only "james-cli" because appassemble will add the extension -->
                            <name>james-cli</name>
                            <!-- Only generate windows bat script and unix sh for this application -->
                            <platforms>
                                <platform>windows</platform>
                                <platform>unix</platform>
                            </platforms>
                        </program>
                    </programs>
                    <daemons>
                        <daemon>
                            <id>james</id>
                            <mainClass>org.apache.james.app.spring.JamesAppSpringMain</mainClass>
                            <commandLineArguments>
                                <commandLineArgument>start</commandLineArgument>
                            </commandLineArguments>
                            <platforms>
                                <!--
                                    =======================================================================

                                    JSW relies on software licensed under the following "Tanuki Software License"

                                    BEGIN Tanuki Software License =========================================
                                    Copyright (c) 1999, 2006 Tanuki Software, Inc.

                                    Permission is hereby granted, free of charge, to any person
                                    obtaining a copy of the Java Service Wrapper and associated
                                    documentation files (the "Software"), to deal in the Software
                                    without restriction, including without limitation the rights
                                    to use, copy, modify, merge, publish, distribute, sub-license,
                                    and/or sell copies of the Software, and to permit persons to
                                    whom the Software is furnished to do so, subject to the
                                    following conditions:

                                    The above copyright notice and this permission notice shall be
                                    included in all copies or substantial portions of the Software.

                                    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
                                    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
                                    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
                                    NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
                                    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
                                    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
                                    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
                                    OTHER DEALINGS IN THE SOFTWARE.


                                    Portions of the Software have been derived from source code
                                    developed by Silver Egg Technology under the following license:

                                    BEGIN Silver Egg Techology License =================================

                                    Copyright (c) 2001 Silver Egg Technology

                                    Permission is hereby granted, free of charge, to any person
                                    obtaining a copy of this software and associated documentation
                                    files (the "Software"), to deal in the Software without
                                    restriction, including without limitation the rights to use,
                                    copy, modify, merge, publish, distribute, sub-license, and/or
                                    sell copies of the Software, and to permit persons to whom the
                                    Software is furnished to do so, subject to the following
                                    conditions:

                                    The above copyright notice and this permission notice shall be
                                    included in all copies or substantial portions of the Software.

                                    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
                                    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
                                    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
                                    NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
                                    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
                                    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
                                    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
                                    OTHER DEALINGS IN THE SOFTWARE.

                                    END Silver Egg Techology License =====================================
                                    END Tanuki Software License ============================================
                                    ========================================================================
                                -->
                                <platform>jsw</platform>
                            </platforms>
                            <generatorConfigurations>
                                <generatorConfiguration>

                                    <generator>jsw</generator>
                                    <includes>
                                        <include>linux-x86-32</include>
                                        <include>linux-x86-64</include>
                                        <include>linux-ppc-64</include>
                                        <include>macosx-x86-universal-32</include>
                                        <include>macosx-ppc-32</include>
                                        <include>solaris-sparc-32</include>
                                        <include>solaris-sparc-64</include>
                                        <include>solaris-x86-32</include>
                                        <include>windows-x86-32</include>
                                        <include>windows-x86-64</include>
                                    </includes>

                                    <configuration>
                                        <!-- add to to the classpath in this order: config files, james jars, user jars.-->
                                        <property>
                                            <name>configuration.directory.in.classpath.first</name>
                                            <value>../conf</value>
                                        </property>
                                        <property>
                                            <name>configuration.directory.in.classpath.last</name>
                                            <value>../conf/lib/*</value>
                                        </property>
                                        <property>
                                            <name>set.default.REPO_DIR</name>
                                            <value>../lib</value>
                                        </property>
                                        <property>
                                            <name>wrapper.working.dir</name>
                                            <value>.</value>
                                        </property>
                                        <property>
                                            <name>wrapper.logfile</name>
                                            <value>../log/wrapper.log</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.library.path</name>
                                            <value>../lib</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.initmemory</name>
                                            <value>128</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.maxmemory</name>
                                            <value>512</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.1</name>
                                            <value>${jvm.system-property1}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.2</name>
                                            <value>${jmx.system-property1}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.3</name>
                                            <value>${jmx.system-property2}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.4</name>
                                            <value>${javamail.system-property1}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.5</name>
                                            <value>${javamail.system-property2}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.6</name>
                                            <value>${javamail.system-property3}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.7</name>
                                            <value>${javamail.system-property4}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.8</name>
                                            <value>${javamail.system-property5}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.9</name>
                                            <value>${javamail.system-property6}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.10</name>
                                            <value>${javamail.system-property7}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.11</name>
                                            <value>${javamail.system-property8}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.12</name>
                                            <value>${javamail.system-property9}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.13</name>
                                            <value>${javamail.system-property10}</value>
                                        </property>
                                        <property>
                                            <name>wrapper.java.additional.14</name>
                                            <value>${james.system-property1}</value>
                                        </property>
                                    </configuration>
                                </generatorConfiguration>
                            </generatorConfigurations>

                        </daemon>
                    </daemons>
                </configuration>
                <executions>
                    <execution>
                        <id>make-appassemble</id>
                        <goals>
                            <goal>assemble</goal>
                            <goal>generate-daemons</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>

                            <tasks>
                                <!-- this is only needed because windows freak out on long cmd lines, so we strip of the absolute path
                                    from the lib dir to make windows happy again
                                -->
                                <replace file="${project.build.directory}/appassembler/bin/run.bat" token="%BASEDIR%\lib" value="..\lib" />
                                <replace file="${project.build.directory}/appassembler/bin/run.sh" token="setenv" value="setenv.sh" />

                                <!-- this is needed because appassembler is not really smart on some settings -->
                                <replace file="${project.build.directory}/appassembler/jsw/james/conf/wrapper.conf" token="lib/wrapper.jar" value="%REPO_DIR%/wrapper.jar" />
                                <replace file="${project.build.directory}/appassembler/jsw/james/bin/james" token="logs" value="var" />
                                <replace file="${project.build.directory}/appassembler/jsw/james/bin/james" token="setenv" value="setenv.sh" />

                                <!-- copy the linux wrapper-linux-x86-32 to wrapper, so use it as default if no matching wrapper was found -->
                                <copy file="${project.build.directory}/appassembler/jsw/james/bin/wrapper-linux-x86-32" tofile="${project.build.directory}/appassembler/jsw/james/bin/wrapper" />
                                <!-- this is only needed because windows freak out on long cmd lines, so we strip of the absolute path
                                    from the lib dir to make windows happy again
                                -->
                                <replace file="${project.build.directory}/appassembler/bin/james-cli.bat" token="%BASEDIR%\lib" value="..\lib" />
                                <replace file="${project.build.directory}/appassembler/bin/james-cli.sh" token="setenv" value="setenv.sh" />
                            </tasks>

                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorSourceDirectory>src/assemble/</descriptorSourceDirectory>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Copy runtime dependency log4j-core to appassembler/lib -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <includeArtifactIds>log4j-core</includeArtifactIds>
                    <includeScope>runtime</includeScope>
                    <outputDirectory>${project.build.directory}/appassembler/lib</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <reuseForks>false</reuseForks>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
