<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>7.0-OD-02-055</version>
  </parent>
  <artifactId>atlassian-jira-webapp-common</artifactId>
  <packaging>war</packaging>
  <name>Atlassian JIRA - Webapp - Common</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>
      <artifactId>atlassian-plugins-osgi</artifactId>
      <groupId>com.atlassian.plugins</groupId>
      <classifier>framework-bundles</classifier>
      <type>zip</type>
      <version>${plugins.version}</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <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>
            <overlay>
              <groupId>com.atlassian.plugins</groupId>
              <artifactId>atlassian-plugins-osgi</artifactId>
              <type>zip</type>
              <classifier>framework-bundles</classifier>
              <targetPath>WEB-INF/osgi-framework-bundles</targetPath>
            </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-common</artifactId>
           <version>${project.version}</version>
           <type>war</type>
           <scope>runtime</scope>
         </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</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-screenshot-applet</artifactId>
                            <version>${project.version}</version>
                            <destFileName>screenshot.jar</destFileName>
                            <outputDirectory>${jira.webapp.directory}/secure/applet</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                </configuration>
              </execution>
            </executions>
          </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>less-css-compile</id>
        <activation>
            <property>
                <name>!jira.lesscss.compile.skip</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.atlassian.lesscss</groupId>
                    <artifactId>lesscss-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>compile-less</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </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>${jira.webapp.directory}/</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>include-metal-assets</id>
        <activation>
            <property>
                <name>!skipMetalAssets</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>com.atlassian.aui</groupId>
                            <artifactId>auiplugin</artifactId>
                            <version>${aui.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.plugins</groupId>
                            <artifactId>jquery</artifactId>
                            <version>${jquery.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <phase>generate-resources</phase>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>com.atlassian.plugins</groupId>
                                        <artifactId>jquery</artifactId>
                                        <version>${jquery.version}</version>
                                        <outputDirectory>${jira.webapp.metal.srcdir}</outputDirectory>
                                        <includes>
                                            jquery.js
                                        </includes>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.lesscss</groupId>
                    <artifactId>lesscss-maven-plugin</artifactId>
                    <version>1.3.3</version>
                    <configuration>
                        <sourceDirectory>${project.basedir}/src/main/webapp/static-assets</sourceDirectory>
                        <outputDirectory>${jira.webapp.metal.srcdir}/css</outputDirectory>
                        <compress>true</compress>
                        <includes>
                            <include>jira-metal.less</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <phase>generate-resources</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                    <executions>
                        <execution>
                            <id>copy-js-resources</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${jira.webapp.metal.srcdir}/js</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}/src/main/webapp/static-assets</directory>
                                        <includes>
                                            <include>jira-metal.js</include>
                                            <include>aui-shim.js</include>
                                        </includes>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                        <execution>
                            <id>copy-css-resources</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${jira.webapp.metal.srcdir}/css</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}/src/main/webapp/static-assets</directory>
                                        <includes>
                                            <include>evil-bespoke-aui-flatpack.css</include>
                                            <include>evil-bespoke-aui-ie9-flatpack.css</include>
                                        </includes>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <executions>
                        <execution>
                            <id>test-jar</id>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                            <configuration>
                                <forceCreation>true</forceCreation>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>yuicompressor-maven-plugin</artifactId>
                    <version>1.3.0</version>
                    <executions>
                        <execution>
                            <id>package-metal</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>compress</goal>
                            </goals>
                            <configuration>
                                <sourceDirectory>${jira.webapp.metal.srcdir}/</sourceDirectory>
                                <outputDirectory>${jira.webapp.metal.minified.srcdir}/</outputDirectory>
                                <excludeWarSourceDirectory>true</excludeWarSourceDirectory>
                                <jswarn>false</jswarn>
                                <nosuffix>true</nosuffix>
                                <aggregations>
                                    <aggregation>
                                        <removeIncluded>true</removeIncluded>
                                        <insertNewLine>true</insertNewLine>
                                        <output>${jira.webapp.directory}/static-assets/metal-all.css</output>
                                        <inputDir>${jira.webapp.metal.minified.srcdir}</inputDir>
                                        <includes>
                                            <include>css/evil-bespoke-aui-flatpack.css</include>
                                            <include>css/jira-metal.css</include>
                                        </includes>
                                    </aggregation>
                                    <aggregation>
                                        <removeIncluded>true</removeIncluded>
                                        <insertNewLine>true</insertNewLine>
                                        <output>${jira.webapp.directory}/static-assets/metal-all-ie9.css</output>
                                        <inputDir>${jira.webapp.metal.minified.srcdir}</inputDir>
                                        <includes>
                                            <include>css/evil-bespoke-aui-ie9-flatpack.css</include>
                                        </includes>
                                    </aggregation>
                                    <aggregation>
                                        <removeIncluded>true</removeIncluded>
                                        <output>${jira.webapp.directory}/static-assets/metal-all.js</output>
                                        <inputDir>${jira.webapp.metal.minified.srcdir}</inputDir>
                                        <includes>
                                            <include>jquery.js</include>
                                            <include>js/aui-shim.js</include>
                                            <include>js/jira-metal.js</include>
                                        </includes>
                                    </aggregation>
                                </aggregations>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
      <id>include-cross-selling-plugins-early</id>
      <activation>
        <property>
          <name>jira.include.cross.selling.plugins.in.common</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>download-servicedesk-obr</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.servicedesk</groupId>
                      <artifactId>jira-servicedesk</artifactId>
                      <version>${bundled.servicedesk.version}</version>
                      <type>obr</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/sd-bundle</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
              <execution>
                <id>copy-jira-agile-evaluation-bundle</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.jira.plugins</groupId>
                      <artifactId>jira-greenhopper-plugin</artifactId>
                      <version>${bundled.agile.version}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/other/jira-agile-plugin</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>copy-service-desk-evaluation-bundle</id>
                <phase>prepare-package</phase>
                <configuration>
                  <tasks>
                    <echo message="unpacking servicedesk obr..." />
                    <unzip src="${project.build.directory}/sd-bundle/jira-servicedesk-${bundled.servicedesk.version}.obr" dest="${project.build.directory}/${project.build.finalName}/WEB-INF/other/service-desk-plugin">
                      <patternset>
                        <include name="**/*.jar" />
                      </patternset>
                      <flattenmapper />
                    </unzip>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
    <properties>
        <jira.webapp.directory>${project.build.directory}/${project.build.finalName}</jira.webapp.directory>
        <jira.webapp.metal.srcdir>${project.build.directory}/metal_sources</jira.webapp.metal.srcdir>
        <jira.webapp.metal.minified.srcdir>${project.build.directory}/metal_sources_min</jira.webapp.metal.minified.srcdir>
    </properties>
</project>
