<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-components</artifactId>
    <version>5.0-rc2</version>
  </parent>
  <artifactId>atlassian-jira-webapp</artifactId>
  <packaging>war</packaging>
  <name>Atlassian JIRA - Code - Webapp</name>
  <dependencies>
    <dependency>
      <!-- this ensures that commons-logging doesn't make it into WEB-INF/lib even if transitively depended on -->
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <!-- SLF4j's implementation of the commons-logging API -->
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-screenshot-applet</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-bundled-plugins</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
          <groupId>org.codehaus.groovy.maven</groupId>
          <artifactId>gmaven-plugin</artifactId>
          <executions>
            <execution>
              <id>clean-web-inf-lib</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>execute</goal>
              </goals>
              <configuration>
                <source>${pom.basedir}/src/main/gmaven/cleanWebInfLib.groovy</source>
              </configuration>
            </execution>
            <execution>
              <id>clean-packaging-excludes</id>
              <phase>package</phase>
              <goals>
                <goal>execute</goal>
              </goals>
              <configuration>
                <source>${pom.basedir}/src/main/gmaven/cleanPackagingExcludes.groovy</source>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-screenshot-applet</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>jira-screenshot-applet</includeArtifactIds>
              <outputDirectory>${project.build.directory}/${project.build.finalName}/secure/applet</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>copy-bundled-plugins</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>jira-bundled-plugins</includeArtifactIds>
              <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <packagingExcludes>WEB-INF/lib/jira-core*.jar</packagingExcludes>
          <overlays>
            <overlay>
              <groupId>com.atlassian.jira</groupId>
              <artifactId>jira-core</artifactId>
              <type>jar</type>
              <targetPath>WEB-INF/classes</targetPath>
              <excludes>
                <exclude>com/atlassian/jira/screenshot/applet/**</exclude>
                <exclude>**/package.html</exclude>
              </excludes>
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
    <finalName>jira</finalName>
  </build>
  <profiles>
    <profile>
      <id>minify-resources</id>
      <activation>
        <property>
          <name>!jira.minify.skip</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>net.sf.alchim</groupId>
            <artifactId>yuicompressor-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>compress-resources</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>compress</goal>
                </goals>
                <configuration>
                  <warSourceDirectory>src/main/webapp/</warSourceDirectory>
                  <webappDirectory>${project.build.directory}/${project.build.finalName}/</webappDirectory>
                  <includes>
                    <include>**/*.css</include>
                    <include>**/*.js</include>
                  </includes>
                  <excludes>
                    <exclude>**/*-min*</exclude>
                    <exclude>**/*.xml</exclude>
                    <exclude>**/calendar-h*.js</exclude>
                    <exclude>**/*.properties</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <jswarn>false</jswarn>
              <encoding>UTF-8</encoding>
              <nomunge>true</nomunge>
              <disableOptimizations>true</disableOptimizations>
              <linebreakpos>-1</linebreakpos>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ide-setup</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.groovy.maven</groupId>
            <artifactId>gmaven-plugin</artifactId>
            <executions>
              <execution>
                <id>create-idea-artifact</id>
                <phase>initialize</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <source>${pom.basedir}/src/main/gmaven/createIdeaArtifact.groovy</source>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
