<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>5.2-beta2</version>
  </parent>
  <artifactId>jira-screenshot-applet</artifactId>
  <name>Atlassian JIRA - Code - Screenshot Applet</name>
  <properties>
    <atlassian.keystore.alias>atlassian</atlassian.keystore.alias>
    <atlassian.keystore.storepass>atlassian</atlassian.keystore.storepass>
    <atlassian.keystore.location>src/main/keystore/keystore</atlassian.keystore.location>
  </properties>
    <profiles>
      <profile>
        <id>sign-screenshot-applet</id>
        <activation>
            <property>
                <name>jira.screenshotapplet.signscreenshotapplet</name>
                <value>true</value>
            </property>
        </activation>      
        <build>
          <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-keystore</id>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                          <artifactItems>
                            <artifactItem>
                              <!-- For now this is a pseudo-artifact which isn't deployed in the maven repository, but exists because of the sandbox deployment -->
                              <groupId>com.atlassian.keystore</groupId>
                              <artifactId>atlassian-keystore</artifactId>
                              <version>1.1</version>
                              <outputDirectory>${project.build.directory}/atlassian-keystore</outputDirectory>
                            </artifactItem>                        
                          </artifactItems>
                       </configuration>
                    </execution>
                </executions>
            </plugin>
          </plugins>
        </build>
        <properties>
          <atlassian.keystore.location>${project.build.directory}/atlassian-keystore/keystore/secure/atlassian.keystore</atlassian.keystore.location>
          <atlassian.keystore.storepass>passwordsameaskeystore</atlassian.keystore.storepass>
        </properties>
      </profile>
    </profiles>
  <dependencies>
    <dependency>
      <groupId>com.atlassian.jira</groupId>
      <artifactId>jira-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <id>unpack-applet-required-utils</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>              
              <includeArtifactIds>jira-core,jira-api</includeArtifactIds>
              <includes>com/atlassian/jira/screenshot/applet/**,com/atlassian/jira/web/util/FileNameCharacterCheckerUtil.class</includes>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jarsigner-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>sign</id>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <keystore>${atlassian.keystore.location}</keystore>
          <alias>${atlassian.keystore.alias}</alias>
          <storepass>${atlassian.keystore.storepass}</storepass>
        </configuration>
      </plugin>
    </plugins>
    <finalName>screenshot</finalName>
  </build>
</project>
