<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.jira</groupId>
    <artifactId>jira-components</artifactId>
    <version>6.0-breakit-mail-plugin-1</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>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>copy-screenshot-applet</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>jira-screenshot-applet</includeArtifactIds>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>com.atlassian.jira</groupId>
              <artifactId>jira-screenshot-applet</artifactId>
              <version>${project.version}</version>
              <destFileName>screenshot.jar</destFileName>
              <outputDirectory>${project.build.directory}/${project.build.finalName}/secure/applet</outputDirectory>
            </artifactItem>
          </artifactItems>
        </configuration>
      </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>
       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-guava</id>
            <goals>
             <goal>enforce</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>true</searchTransitive>
                  <message>Something is depending on google-collections (perhaps transitively), but we use guava</message>
                    <excludes>
                     <exclude>com.google.collections:google-collections</exclude>
                    </excludes>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
            </execution>
        </executions>
        </plugin>
    </plugins>
    <finalName>jira</finalName>
  </build>
  <profiles>
    <profile>
      <id>no-war</id>
      <activation>
        <property>
          <name>jira.do.not.prepare.war</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
            <executions>
              <execution>
                <id>default-war</id>
                <phase>none</phase>
              </execution>
              <execution>
                <id>war-exploded</id>
                <phase>package</phase>
                <goals>
                  <goal>exploded</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
       <id>add-bundled-plugins</id>
       <activation>
         <property>
           <name>!jira.exclude.bundled.plugins</name>
         </property>
       </activation>
       <dependencies>
         <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>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>copy-bundled-plugins</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <includeArtifactIds>jira-bundled-plugins</includeArtifactIds>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.atlassian.jira</groupId>
                  <artifactId>jira-bundled-plugins</artifactId>
                  <version>${project.version}</version>
                  <type>zip</type>
                  <destFileName>atlassian-bundled-plugins.zip</destFileName>
                  <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes
                  </outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>no-skip-test-compile</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
      </activation>
      <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>
        </plugins>
      </build>
    </profile>
    <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>-->
    <profile>
      <id>build-from-source-dist</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-bundled-plugins</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.jira</groupId>
                      <artifactId>jira-bundled-plugins</artifactId>
                      <version>${project.version}</version>
                      <type>zip</type>
                      <destFileName>atlassian-bundled-plugins.zip</destFileName>
                    </artifactItem>
                  </artifactItems>
                  <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
