<?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>
    <groupId>org.codehaus.sonar</groupId>
    <artifactId>sonar</artifactId>
    <version>3.2-SNAPSHOT</version>
  </parent>
  <artifactId>sonar-server</artifactId>
  <packaging>war</packaging>
  <name>Sonar :: Server</name>

  <dependencies>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-batch</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-batch-maven-compat</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-channel</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-colorizer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-deprecated</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-java-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-markdown</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-update-center-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derbyclient</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-plugin-api</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.maven.shared</groupId>
          <artifactId>maven-dependency-tree</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.maven.shared</groupId>
          <artifactId>maven-common-artifact-filters</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>commons-configuration</groupId>
      <artifactId>commons-configuration</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derbynet</artifactId>
    </dependency>
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.picocontainer</groupId>
      <artifactId>picocontainer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jfree</groupId>
      <artifactId>jfreechart</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-ehcache</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jruby.rack</groupId>
      <artifactId>jruby-rack</artifactId>
    </dependency>
    <dependency>
      <!-- GZIP filter -->
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-util</artifactId>
    </dependency>

    <!-- unit tests -->
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-testing-harness</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/src/main/webapp/deploy</directory>
              <includes>
                <include>gwt/**/*</include>
                <include>maven/**/*</include>
                <include>jdbc-driver.jar</include>
                <include>plugins/**/*</include>
              </includes>
              <excludes>
                <exclude>maven/README.txt</exclude>
                <exclude>maven/index.html</exclude>
                <exclude>**/.svn/**/*</exclude>
              </excludes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.codehaus.sonar</groupId>
                  <artifactId>sonar-colorizer</artifactId>
                  <version>${project.version}</version>
                  <outputDirectory>${basedir}/src/main/webapp/stylesheets</outputDirectory>
                  <includes>**/sonar-colorizer.css</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/${project.build.finalName}/</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/webapp</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>net.sf.alchim</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <version>0.7.1</version>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <nosuffix>false</nosuffix>
          <failOnWarning>false</failOnWarning>
          <jswarn>false</jswarn>
          <sourceDirectory>src/main/webapp/javascripts</sourceDirectory>
          <outputDirectory>${project.build.directory}/${project.build.finalName}/javascripts</outputDirectory>
          <aggregations>
            <aggregation>
              <includes>
                <include>**/application-min.js</include>
                <include>**/prototype-min.js</include>
                <include>**/scriptaculous-min.js</include>
                <include>**/tablekit-min.js</include>
                <include>**/prototip-min.js</include>
                <include>**/dashboard-min.js</include>
                <include>**/protovis-min.js</include>
                <include>**/protovis-sonar-min.js</include>
                <include>**/duplication-min.js</include>
                <include>**/resource-min.js</include>
              </includes>
              <output>${project.build.directory}/${project.build.finalName}/javascripts/sonar.js</output>
            </aggregation>
            <aggregation>
              <includes>
                <include>**/yui-2.6.0-min.css</include>
                <include>**/style-min.css</include>
                <include>**/sonar-colorizer-min.css</include>
                <include>**/dashboard-min.css</include>
              </includes>
              <output>${project.build.directory}/${project.build.finalName}/stylesheets/sonar.css</output>
            </aggregation>
          </aggregations>
          <excludes>
            <exclude>**/gems/**/*.js</exclude>
            <exclude>**/gems/**/*.css</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.sonar</groupId>
        <artifactId>sonar-dev-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>trim</id>
            <phase>process-resources</phase>
            <goals>
              <goal>trim</goal>
            </goals>
            <configuration>
              <directory>${project.build.directory}/${project.build.finalName}</directory>
              <includes>
                <include>**/*.erb</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <packagingExcludes>
            **/*.log,*.iml,WEB-INF/script/,WEB-INF/test/,javascripts/*-min.js,stylesheets/*-min.css
          </packagingExcludes>
          <warSourceExcludes>
            **/*
          </warSourceExcludes>
          <archive>
            <manifestEntries>
              <Version>${project.version}</Version>
              <!-- ${buildNumber} is the Git revision. It's generated by the buildnumber-maven-plugin -->
              <Implementation-Build>${buildNumber}</Implementation-Build>
              <Build-Time>${timestamp}</Build-Time>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>start-dev-server</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-plugins</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <overWriteReleases>true</overWriteReleases>
                  <overWriteSnapshots>true</overWriteSnapshots>
                  <includeTypes>sonar-plugin</includeTypes>
                  <outputDirectory>${project.build.directory}/sonar-dev-home/lib/core-plugins/</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-conf</id>
                <phase>validate</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/sonar-dev-home</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/dev/${jdbcDialect}</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>7.1.0.v20100505</version>
            <configuration>
              <webAppConfig>
                <contextPath>/dev</contextPath>
                <defaultsDescriptor>${basedir}/src/dev/webdefault.xml</defaultsDescriptor>
                <descriptor>${basedir}/src/dev/web.xml</descriptor>
              </webAppConfig>
              <connectors>
                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                  <port>9000</port>
                  <maxIdleTime>60000</maxIdleTime>
                </connector>
              </connectors>
              <systemProperties>
                <systemProperty>
                  <name>SONAR_HOME</name>
                  <value>${project.build.directory}/sonar-dev-home</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <!-- core plugins -->
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-core-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-design-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-findbugs-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-checkstyle-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-dbcleaner-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-pmd-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-squid-java-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-cobertura-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-surefire-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-cpd-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-l10n-en-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-email-notifications-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.sonar.plugins</groupId>
          <artifactId>sonar-jacoco-plugin</artifactId>
          <version>${project.version}</version>
          <type>sonar-plugin</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>postgresql</id>
      <properties>
        <jdbcDialect>postgresql</jdbcDialect>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/classes</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${basedir}/src/dev/postgresql</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-jdbc-driver</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <overWriteReleases>true</overWriteReleases>
                  <includeGroupIds>postgresql</includeGroupIds>
                  <includeArtifactIds>postgresql</includeArtifactIds>
                  <outputDirectory>${project.build.directory}/sonar-dev-home/extensions/jdbc-driver/postgresql/
                  </outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>postgresql</groupId>
          <artifactId>postgresql</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>mysql</id>
      <properties>
        <jdbcDialect>mysql</jdbcDialect>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/classes</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${basedir}/src/dev/mysql</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-jdbc-driver</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <overWriteReleases>true</overWriteReleases>
                  <includeGroupIds>mysql</includeGroupIds>
                  <includeArtifactIds>mysql-connector-java</includeArtifactIds>
                  <outputDirectory>${project.build.directory}/sonar-dev-home/extensions/jdbc-driver/mysql/
                  </outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>derby</id>
      <properties>
        <jdbcDialect>derby</jdbcDialect>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/classes</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${basedir}/src/dev/derby</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-jdbc-driver</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <overWriteReleases>true</overWriteReleases>
                  <includeGroupIds>org.apache.derby</includeGroupIds>
                  <includeArtifactIds>derbyclient</includeArtifactIds>
                  <outputDirectory>${project.build.directory}/sonar-dev-home/extensions/jdbc-driver/derby/
                  </outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.apache.derby</groupId>
          <artifactId>derbyclient</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>