<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>com.atlassian.crowd.distribution</groupId>
        <artifactId>crowd-distribution</artifactId>
        <version>3.4.0-m05-dry-run</version>
    </parent>
    <groupId>com.atlassian.crowd</groupId>
    <artifactId>crowd-standalone-distribution</artifactId>

    <packaging>pom</packaging>
    <name>Atlassian Crowd Standalone Distribution</name>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.crowd.distribution</groupId>
            <artifactId>crowd-common-distribution</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-openid-client</artifactId>
            <type>war</type>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-openid-server</artifactId>
            <type>war</type>
            <version>${project.version}</version>
        </dependency>
        <!-- Console -->
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-web-app</artifactId>
            <type>war</type>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-client-libraries</artifactId>
            <type>zip</type>
            <version>${project.version}</version>
        </dependency>

        <!-- javadoc
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-javadoc</artifactId>
            <type>zip</type>
            <version>${project.version}</version>
        </dependency>
        -->

        <!-- tomcat libraries -->
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-tomcat-libraries</artifactId>
            <type>zip</type>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>apache-tomcat</artifactId>
            <type>zip</type>
            <version>${tomcat.artifact.version}</version>
            <!-- we need the windows version as it contains both the *.sh and *.exe files from Tomcat 6.0.24+ -->
            <!-- if the tomcat distro ever changes format, we will need to update this here and below in the maven dep plugin -->
            <classifier>windows-x86</classifier>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>apache-tomcat</artifactId>
            <type>zip</type>
            <version>${tomcat.artifact.version}</version>
            <!-- we need the windows version as it contains both the *.sh and *.exe files from Tomcat 6.0.24+ -->
            <!-- if the tomcat distro ever changes format, we will need to update this here and below in the maven dep plugin -->
            <classifier>windows-x64</classifier>
        </dependency>

        <dependency>
            <groupId>com.oopsconsultancy</groupId>
            <artifactId>xmltask</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>atlassian-crowd</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.apache.tomcat</groupId>
                            <artifactId>apache-tomcat</artifactId>
                            <classifier>windows-x86</classifier>
                            <type>zip</type>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                            <groupId>org.apache.tomcat</groupId>
                            <artifactId>apache-tomcat</artifactId>
                            <classifier>windows-x64</classifier>
                            <type>zip</type>
                            <outputDirectory>${project.build.directory}/x64</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </plugin>

            <!-- Change the DOS line endings so the patch applies clean in all platforms.
                 Line endings are later restored by the assembly plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dos2unix</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <fixcrlf file="${project.build.directory}/apache-tomcat-${tomcat.version}/bin/service.bat" eol="unix" />
                                <fixcrlf file="${project.build.directory}/apache-tomcat-${tomcat.version}/conf/catalina.properties" eol="unix" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-x64-tomcat-file</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <copy file="${project.build.directory}/x64/apache-tomcat-${tomcat.version}/bin/tcnative-1.dll" tofile="${project.build.directory}/apache-tomcat-${tomcat.version}/bin/tcnative-1.dll.x64" />
                                <copy file="${project.build.directory}/x64/apache-tomcat-${tomcat.version}/bin/tomcat8.exe" tofile="${project.build.directory}/apache-tomcat-${tomcat.version}/bin/tomcat8.exe.x64" />
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Patch the Tomcat service installation script -->
            <plugin>
                <artifactId>maven-patch-plugin</artifactId>
                <executions>
                    <execution>
                        <id>patch-tomcat-files</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <configuration>
                            <targetDirectory>${project.build.directory}/apache-tomcat-${tomcat.version}</targetDirectory>
                            <patches>
                                <patch>windows-service-arguments.patch</patch>
                                <patch>catalina-properties.patch</patch>
                            </patches>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>standalone</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/standalone.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
