<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.3.5</version>
  </parent>
  <artifactId>atlassian-jira-webapp</artifactId>
  <packaging>war</packaging>
  <name>Atlassian JIRA - 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>javax.servlet</groupId>
          <artifactId>jsp-api</artifactId>
          <version>2.0</version>
          <scope>provided</scope>
      </dependency>
    <dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.atlassian.plugins</groupId>
      <artifactId>atlassian-plugins-framework-bundles</artifactId>
      <type>zip</type>
      <version>${plugins.version}</version>
      <classifier>${plugins.spring.classifier}</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>${jackson.version}</version>
        <scope>runtime</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <packagingExcludes>WEB-INF/lib/jira-core*.jar,WEB-INF/lib/*applet*</packagingExcludes>
          <webResources>
            <resource>
              <filtering>true</filtering>
              <directory>src/main/webapp/WEB-INF/classes</directory>
              <includes>
                <include>product.properties</include>
              </includes>
              <targetPath>WEB-INF/classes</targetPath>
            </resource>
          </webResources>
          <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-framework-bundles</artifactId>
              <type>zip</type>
              <classifier>${plugins.spring.classifier}</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>
            <execution>
                <id>enforce-javamail</id>
                <goals>
                    <goal>enforce</goal>
                </goals>
                <phase>validate</phase>
                <configuration>
                    <rules>
                        <bannedDependencies>
                            <searchTransitive>true</searchTransitive>
                            <message>Something is depending on javax.mail:mail (perhaps transitively), but we use javax.mail:javax.mail-api and com.sun.mail:javax.mail</message>
                            <excludes>
                                <exclude>javax.mail:mail</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>pom</type>
         </dependency>
       </dependencies>
      <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>retrieve-bundle-plugins-definitions</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-bundled-plugins</artifactId>
                                    <version>${project.version}</version>
                                    <type>txt</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <destFileName>jira-bundled-plugins.txt</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>smartass-maven-plugin</artifactId>
                <version>${smartass.version}</version>
                <executions>
                    <execution>
                        <id>download-bundled-plugins-artifacts</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-listed-artifacts</goal>
                        </goals>
                        <configuration>
                            <sourceList>
                                ${project.build.directory}/jira-bundled-plugins.txt
                            </sourceList>
                            <targetDirectory>
                                ${project.build.directory}/${project.build.finalName}/WEB-INF/atlassian-bundled-plugins
                            </targetDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
      </build>
    </profile>
      <profile>
          <!-- this provile is for jmake debug -\-full-plugin-system to set up a full webapp with bundled plugins,
               not with the list of plugins via the -Djira.dev.bundledplugins.url -->
          <id>dev-full-plugin-system</id>
          <activation>
              <property>
                  <name>jira.dev.full.plugin.system</name>
              </property>
          </activation>
          <dependencies>
              <dependency>
                  <groupId>com.atlassian.jira</groupId>
                  <artifactId>jira-bundled-plugins</artifactId>
                  <version>${project.version}</version>
                  <type>pom</type>
              </dependency>
          </dependencies>
          <build>
              <plugins>
                  <plugin>
                      <artifactId>maven-dependency-plugin</artifactId>
                      <version>2.10</version>
                      <executions>
                          <execution>
                              <id>retrieve-full-bundle-plugins-definitions</id>
                              <phase>prepare-package</phase>
                              <goals>
                                  <goal>copy</goal>
                              </goals>
                              <configuration>
                                  <artifactItems>
                                      <artifactItem>
                                          <groupId>com.atlassian.jira</groupId>
                                          <artifactId>jira-bundled-plugins</artifactId>
                                          <version>${project.version}</version>
                                          <type>txt</type>
                                          <overWrite>true</overWrite>
                                          <outputDirectory>${project.build.directory}</outputDirectory>
                                          <destFileName>jira-bundled-plugins.txt</destFileName>
                                      </artifactItem>
                                  </artifactItems>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
                  <plugin>
                      <groupId>com.atlassian.maven.plugins</groupId>
                      <artifactId>smartass-maven-plugin</artifactId>
                      <version>${smartass.version}</version>
                      <executions>
                          <execution>
                              <id>download-bundled-plugins-artifacts-eap</id>
                              <phase>prepare-package</phase>
                              <goals>
                                  <goal>copy-listed-artifacts</goal>
                              </goals>
                              <configuration>
                                  <sourceList>
                                      ${project.build.directory}/jira-bundled-plugins.txt
                                  </sourceList>
                                  <targetDirectory>
                                      ${project.build.directory}/${project.build.finalName}/WEB-INF/atlassian-bundled-plugins
                                  </targetDirectory>
                              </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>precompile-jsp</id>
          <activation>
              <property>
                  <name>!jira.precompile.jsp.skip</name>
              </property>
          </activation>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.jasig.mojo.jspc</groupId>
                      <artifactId>jspc-maven-plugin</artifactId>
                      <version>2.0.0</version>
                      <executions>
                          <execution>
                              <phase>compile</phase>
                              <goals>
                                  <goal>compile</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <!-- same as in tomcat config! -->
                          <trimSpaces>false</trimSpaces>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-war-plugin</artifactId>
                      <configuration>
                          <webXml>${pom.basedir}/target/jspweb.xml</webXml>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
      </profile>
      <profile>
          <id>clover.func.tests</id>
          <activation>
              <property>
                  <name>clover.func.tests</name>
              </property>
          </activation>
          <dependencies>
              <dependency>
                  <groupId>com.atlassian.clover</groupId>
                  <artifactId>clover</artifactId>
              </dependency>
          </dependencies>
      </profile>
      <profile>
          <id>jmake-ondemand-webapp-fast-compile</id>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-dependency-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>unpack-studio-default-properties</id>
                              <phase>process-resources</phase>
                              <goals>
                                  <goal>unpack</goal>
                              </goals>
                              <configuration>
                                  <artifactItems>
                                      <artifactItem>
                                          <groupId>com.atlassian.studio</groupId>
                                          <artifactId>ondemand-webapps-common</artifactId>
                                          <version>${ondemand.core.version}</version>
                                          <type>jar</type>
                                          <outputDirectory>${project.build.directory}/war/exploded/WEB-INF/classes</outputDirectory>
                                          <includes>**/studio.default.properties</includes>
                                      </artifactItem>
                                  </artifactItems>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
          <dependencies>
              <!-- Needed for the above unpack task -->
              <dependency>
                  <groupId>com.atlassian.studio</groupId>
                  <artifactId>ondemand-webapps-common</artifactId>
                  <version>${ondemand.core.version}</version>
                  <scope>provided</scope>
              </dependency>


              <!-- these are copied over from jira-ondemand-webapp, remove this info after fork. -->
              <dependency>
                  <groupId>com.atlassian.core</groupId>
                  <artifactId>atlassian-core</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.atlassian.core</groupId>
                  <artifactId>atlassian-core-user</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.atlassian.core</groupId>
                  <artifactId>atlassian-core-thumbnail</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.apache.velocity</groupId>
                  <artifactId>velocity</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.atlassian.jira</groupId>
                  <artifactId>jira-ondemand-host-components</artifactId>
                  <version>${project.version}</version>
              </dependency>
              <dependency>
                  <groupId>com.atlassian.ondemand</groupId>
                  <artifactId>ondemand-api</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.atlassian.studio</groupId>
                  <artifactId>studio-common-host-components</artifactId>
              </dependency>
          </dependencies>
      </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>
