<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

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

  <groupId>sonia.scm</groupId>
  <artifactId>scm-webapp</artifactId>
  <packaging>war</packaging>
  <version>1.20</version>
  <name>scm-webapp</name>

  <dependencies>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${servlet.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- fix javadoc -->
    
    <dependency>    
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
      <version>1.1</version>
      <scope>provided</scope>
    </dependency>
    
    <!-- scm -->
    
    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-core</artifactId>
      <version>1.20</version>
    </dependency>
    
    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-dao-xml</artifactId>
      <version>1.20</version>
    </dependency>

    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-hg-plugin</artifactId>
      <version>1.20</version>
    </dependency>

    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-svn-plugin</artifactId>
      <version>1.20</version>
    </dependency>

    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-git-plugin</artifactId>
      <version>1.20</version>
    </dependency>

    <!-- rest api -->

    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-server</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-json</artifactId>
      <version>${jersey.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>stax-api</artifactId>
          <groupId>stax</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jaxb-impl</artifactId>
          <groupId>com.sun.xml.bind</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-bundle</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey.contribs</groupId>
      <artifactId>jersey-guice</artifactId>
      <version>${jersey.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>jersey-grizzly2</artifactId>
          <groupId>com.sun.jersey</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    
    <!-- injection -->

    <dependency>
      <groupId>com.google.inject.extensions</groupId>
      <artifactId>guice-multibindings</artifactId>
      <version>${guice.version}</version>
    </dependency>
    
    <!-- logging -->

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    
    <!-- cache -->

    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache-core</artifactId>
      <version>${ehcache.version}</version>
    </dependency>
    
    <!-- only for BeanComparator, replace with own implementation -->
    
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.8.3</version>
    </dependency>
    
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.2.1</version>
    </dependency>
    
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm</artifactId>
      <version>3.3.1</version>
    </dependency>
    
    <!-- template engine -->

    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>${freemarker.version}</version>
    </dependency>
    
    <dependency>
      <groupId>com.github.spullara.mustache.java</groupId>
      <artifactId>compiler</artifactId>
      <version>${mustache.version}</version>
    </dependency>

    <!-- aether -->

    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-api</artifactId>
      <version>${aether.version}</version>
    </dependency>

    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-impl</artifactId>
      <version>${aether.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-aether-provider</artifactId>
      <version>${maven.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>plexus-component-annotations</artifactId>
          <groupId>org.codehaus.plexus</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.sonatype.aether</groupId>
      <artifactId>aether-connector-asynchttpclient</artifactId>
      <version>${aether.version}</version>
    </dependency>
    
    <!-- rest documentation -->
    
    <dependency>
      <groupId>org.codehaus.enunciate</groupId>
      <artifactId>enunciate-jersey-rt</artifactId>
      <version>${enunciate.version}</version>
      <!-- fix conflict with jersey-json -->
      <exclusions>
        <exclusion>
          <artifactId>jackson-jaxrs</artifactId>
          <groupId>org.codehaus.jackson</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-xc</artifactId>
          <groupId>org.codehaus.jackson</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- test scope -->

    <dependency>
      <groupId>sonia.scm</groupId>
      <artifactId>scm-test</artifactId>
      <version>1.20</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-simple</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    
    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-git-plugin</artifactId>
      <version>1.20</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-hg-plugin</artifactId>
      <version>1.20</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>sonia.scm.plugins</groupId>
      <artifactId>scm-svn-plugin</artifactId>
      <version>1.20</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <version>2.25.0</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-firefox-driver</artifactId>
      <version>2.25.0</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>com.jcraft</groupId>
      <artifactId>jsch</artifactId>
      <version>0.1.48</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
      <version>${jersey.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey.contribs</groupId>
      <artifactId>jersey-apache-client</artifactId>
      <version>${jersey.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <plugins>
    
      <plugin>
        <groupId>com.mycila.maven-license-plugin</groupId>
        <artifactId>maven-license-plugin</artifactId>
        <version>1.9.0</version>
        <configuration>
          <header>http://download.scm-manager.org/licenses/mvn-license.txt</header>
          <includes>
            <include>src/**</include>
            <include>**/test/**</include>
          </includes>
          <excludes>
            <exclude>target/**</exclude>
            <exclude>.hg/**</exclude>
            <exclude>**/extjs/**</exclude>
            <exclude>**/syntaxhighlighter/**</exclude>
          </excludes>
          <strictCheck>true</strictCheck>
        </configuration>
      </plugin>
      

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>list</goal>
            </goals>
            <configuration>
              <includeScope>runtime</includeScope>
              <outputFile>${project.build.directory}/classes/config/dependencies.list</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>sonia.maven</groupId>
        <artifactId>change-env</artifactId>
        <version>1.0</version>
        <configuration>
          <environment>${environment.profile}</environment>
          <pattern>.*(\.{env})\.xml</pattern>
        </configuration>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>change-env</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.26</version>
        <configuration>
          <stopPort>8005</stopPort>
          <stopKey>STOP</stopKey>
          <systemProperties>
            <systemProperty>
              <name>scm.home</name>
              <value>${scm.home}</value>
            </systemProperty>
            <systemProperty>
              <name>scm.stage</name>
              <value>${scm.stage}</value>
            </systemProperty>
          </systemProperties>
          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8081</port>
              <maxIdleTime>60000</maxIdleTime>
              <headerBufferSize>16384</headerBufferSize>
            </connector>
          </connectors>
          <contextPath>/scm</contextPath>
          <source>${project.build.javaLevel}</source>
          <target>${project.build.javaLevel}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <scanIntervalSeconds>0</scanIntervalSeconds>
        </configuration>
      </plugin>        
      
    </plugins>

    <finalName>scm-webapp</finalName>
  </build>

  <properties>
    <scm.stage>DEVELOPMENT</scm.stage>
    <scm.home>target/scm-it</scm.home>
    <environment.profile>default</environment.profile>
    <enunciate.version>1.26</enunciate.version>
    <aether.version>1.13.1</aether.version>
    <wagon.version>1.0</wagon.version>
    <maven.version>3.0.4</maven.version>
    <mustache.version>0.8.4</mustache.version>
    <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
  </properties>

  <profiles>
    
    <profile>
      <id>cluster</id>
      
      <dependencies>
        
        <dependency>
          <groupId>sonia.scm</groupId>
          <artifactId>scm-dao-orientdb</artifactId>
          <version>1.20</version>
        </dependency>
        
      </dependencies>
    </profile>

    <profile>
      <id>release</id>

      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <webResources>
                <resource>
                  <directory>${project.build.directory}/web-compressor</directory>
                </resource>
              </webResources>
            </configuration>
          </plugin>


          <plugin>
            <groupId>sonia.maven</groupId>
            <artifactId>web-compressor</artifactId>
            <version>1.2</version>
            <executions>
              <execution>
                <phase>prepare-package</phase>
                <goals>
                  <goal>partial-compress-template</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <source>src/main/webapp/index.mustache</source>
              <target>${project.build.directory}/web-compressor/index.mustache</target>
            </configuration>
          </plugin>

        </plugins>
      </build>

      <properties>
        <environment.profile>release</environment.profile>
      </properties>
    </profile>

    <profile>
      <id>it</id>

      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.12</version>
            <configuration>
              <includes>
                <include>sonia/scm/it/*ITCase.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
              <execution>
                <id>verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.26</version>
            <configuration>
              <stopPort>8085</stopPort>
              <stopKey>STOP</stopKey>
              <systemProperties>
                <systemProperty>
                  <name>scm.home</name>
                  <value>target/scm-it</value>
                </systemProperty>
              </systemProperties>
              <connectors>
                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                  <port>8081</port>
                  <maxIdleTime>60000</maxIdleTime>
                </connector>
              </connectors>
              <source>${project.build.javaLevel}</source>
              <target>${project.build.javaLevel}</target>
              <encoding>${project.build.sourceEncoding}</encoding>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <daemon>true</daemon>
            </configuration>
            <executions>
              <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>deploy-war</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-jetty</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          
        </plugins>
      </build>

    </profile>
    
    <profile>
      <id>selenium</id>
          
      <build>
        <plugins>
          
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.12</version>
            <configuration>
              <includes>
                <include>sonia/scm/selenium/*ITCase.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
              <execution>
                <id>verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.26</version>
            <configuration>
              <stopPort>8086</stopPort>
              <stopKey>STOP</stopKey>
              <systemProperties>
                <systemProperty>
                  <name>scm.home</name>
                  <value>target/scm-it</value>
                </systemProperty>
              </systemProperties>
              <connectors>
                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                  <port>8082</port>
                  <maxIdleTime>60000</maxIdleTime>
                </connector>
              </connectors>
              <source>${project.build.javaLevel}</source>
              <target>${project.build.javaLevel}</target>
              <encoding>${project.build.sourceEncoding}</encoding>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <daemon>true</daemon>
            </configuration>
            <executions>
              <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>deploy-war</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-jetty</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>selenium-maven-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>start-selenium-server</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start-server</goal>
                </goals>
                <configuration>
                  <background>true</background>
                </configuration>
              </execution>
              <execution>
                <id>stop-selenium-server</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop-server</goal>
                </goals>                
              </execution>
            </executions>
          </plugin>
          
        </plugins>
      </build>
      
    </profile>
    
    <profile>
      <id>doc</id>
      
      <build>
        <plugins>
          
          <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>${enunciate.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>docs</goal>
                </goals>
                <phase>compile</phase>
              </execution>
            </executions>
            <configuration>
              <configFile>src/main/doc/enunciate.xml</configFile>
              <docsDir>${project.build.directory}/docs</docsDir>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.codehaus.enunciate</groupId>
                <artifactId>enunciate-jersey</artifactId>
                <version>${enunciate.version}</version>
              </dependency>
            </dependencies>
          </plugin>
          
        </plugins>
      </build>
    </profile>

  </profiles>
  
</project>

