<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  
  <parent>
    <artifactId>scm</artifactId>
    <groupId>sonia.scm</groupId>
    <version>1.20</version>
  </parent>

  <groupId>sonia.scm</groupId>
  <artifactId>scm-server</artifactId>
  <version>1.20</version>
  <name>scm-server</name>
  <packaging>jar</packaging>

  <dependencies>

    <dependency>
      <groupId>commons-daemon</groupId>
      <artifactId>commons-daemon</artifactId>
      <version>1.0.10</version>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-webapp</artifactId>
      <version>${jetty.version}</version>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-jmx</artifactId>
      <version>${jetty.version}</version>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-ajp</artifactId>
      <version>${jetty.version}</version>
    </dependency>

  </dependencies>

  <build>

    <plugins>

      <plugin>
        <groupId>sonia.maven</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.2.0.2</version>
        <executions>
          <execution>
            <id>scm-app</id>
            <phase>package</phase>
            <goals>
              <goal>create-repository</goal>
              <goal>generate-daemons</goal>
            </goals>
            <configuration>
              <target>${project.build.directory}/appassembler</target>
              <assembleDirectory>${project.build.directory}/appassembler/commons-daemon/scm-server</assembleDirectory>
              <repoPath>lib</repoPath>
              <repositoryLayout>flat</repositoryLayout>
              <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
              <daemons>
                <daemon>

                  <id>scm-server</id>
                  <version>1.0.10</version>
                  <mainClass>sonia.scm.server.ScmServerDaemon</mainClass>
                  <platforms>
                    <platform>commons-daemon</platform>
                  </platforms>
                  
                  <jvmSettings>
                    <systemProperties>
                      <arg>java.awt.headless=true</arg>
                      <arg>logback.configurationFile=logging.xml</arg>
                    </systemProperties>
                  </jvmSettings>

                  <generatorConfigurations>
                    <generatorConfiguration>

                      <generator>commons-daemon</generator>
                      <configuration>
                        <property>
                          <name>configuration.directory</name>
                          <value>conf</value>
                        </property>
                        <property>
                          <name>darwin.arch.enable</name>
                          <value>false</value>
                        </property>
                      </configuration>

                    </generatorConfiguration>
                  </generatorConfigurations>

                </daemon>
              </daemons>

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

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>scm-webapp</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <outputDirectory>${project.build.directory}/appassembler/commons-daemon/scm-server/var/webapp</outputDirectory>
                  <destFileName>scm-webapp.war</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/scm-server-app.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

    <finalName>scm-server</finalName>
  </build>

</project>
