<?xml version="1.0" encoding="UTF-8"?>

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-plugins</artifactId>
        <version>7.4.4</version>
    </parent>

    <groupId>com.atlassian.jira.plugins</groupId>
    <artifactId>jira-auditing-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian JIRA - Plugins - Auditing Plugin [Audit Log]</name>
    <description>JIRA Auditing Plugin</description>

    <properties>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <auditLogSkipIts>true</auditLogSkipIts>
        <generated-src>${project.build.directory}/generated-src</generated-src>
        <prettyurls.version>1.8</prettyurls.version>
        <scala.version>2.10.4</scala.version>
        <scala.version.base>2.10</scala.version.base>
        <skip.antrunner>false</skip.antrunner>
        <xvfb.enable>true</xvfb.enable>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-webdriver-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.atlassian.jira</groupId>
                    <artifactId>jira-rest-java-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${apache.httpcore.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-api</artifactId>
            <version>2.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-core</artifactId>
            <version>2.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient-cache</artifactId>
            <version>4.2.1-atlassian-2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Scala dependencies -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.version.base}</artifactId>
            <version>2.1.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.joda</groupId>
            <artifactId>joda-convert</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>

        <!-- transformless plugins dependencies -->
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- other dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.prettyurls</groupId>
            <artifactId>atlassian-pretty-urls-plugin</artifactId>
            <version>${prettyurls.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- REST module dependencies -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-module</artifactId>
            <version>${rest.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.spray</groupId>
            <artifactId>spray-json_2.10.0-RC5</artifactId>
            <version>1.2.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.supercsv</groupId>
            <artifactId>super-csv</artifactId>
            <version>2.1.0</version>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/xml</directory>
                <targetPath>xml</targetPath>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <shortRevisionLength>8</shortRevisionLength>
                    <revisionOnScmFailure>unknown</revisionOnScmFailure>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${project.version}</productVersion>
                    <productDataVersion>${project.version}</productDataVersion>

                    <skipManifestValidation>true</skipManifestValidation>
                    <extractDependencies>false</extractDependencies>

                    <skipITs>${auditLogSkipIts}</skipITs>
                    
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>
                            scala.*;version="${range;[==,=+);${scala.version}}",
                            com.atlassian.soy.renderer,
                            com.atlassian.jira.plugin.webfragment.conditions,
                            com.atlassian.crowd.embedded.api,
                            com.atlassian.jira.plugin.profile,
                            com.atlassian.jira.issue,
                            com.atlassian.jira.project,
                            com.atlassian.jira.web.util,
                            org.ofbiz.core.entity,
                            *;resolution:=optional
                        </Import-Package>
                        <Export-Package />
                    </instructions>
                    <testInstructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}-tests</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Export-Package />
                    </testInstructions>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.tests</groupId>
                            <artifactId>jira-testkit-plugin</artifactId>
                            <version>${testkit.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-func-test-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <systemPropertyVariables>
                        <xvfb.enable>${xvfb.enable}</xvfb.enable>
                        <atlassian.test.target.dir>${project.build.directory}</atlassian.test.target.dir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <id>add-generated-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated-src}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <!-- Generate build properties -->
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />

                                <tstamp>
                                    <format property="touch.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ" />
                                </tstamp>
                                <copy file="${project.basedir}/src/main/scala/com/atlassian/jira/plugins/auditing/version/BuildPropertiesImpl.scala.template" tofile="${generated-src}/com/atlassian/jira/plugins/auditing/version/BuildPropertiesImpl.scala" overwrite="true" />
                                <replace file="${generated-src}/com/atlassian/jira/plugins/auditing/version/BuildPropertiesImpl.scala" token="@BUILD_DATE@" value="${touch.time}" />
                                <replace file="${generated-src}/com/atlassian/jira/plugins/auditing/version/BuildPropertiesImpl.scala" token="@VERSION@" value="${project.version}" />
                                <replace file="${generated-src}/com/atlassian/jira/plugins/auditing/version/BuildPropertiesImpl.scala" token="@CHANGE_SET@" value="${buildNumber}" />
                            </target>
                            <skip>${skip.antrunner}</skip>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>1.0b3</version>
                        <exclusions>
                            <exclusion>
                                <groupId>ant</groupId>
                                <artifactId>ant</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>unit-test-compile</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin><!--
                    See http://davidb.github.io/scala-maven-plugin/index.html for full details
                 -->
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.1.5</version>
                <executions>
                    <execution>
                        <id>scala-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <args>
                        <!-- to avoid 'error: File name too long' in Linux/ecryptfs file system -->
                        <arg>-Xmax-classfile-name</arg>
                        <arg>143</arg>
                        <arg>-unchecked</arg>
                        <arg>-deprecation</arg>
                        <!--<arg>-explaintypes</arg>-->
                        <arg>-feature</arg>
                        <arg>-language:_</arg>
                        <arg>-target:jvm-1.6</arg>
                    </args>
                    <!--
                        we don't want the scala compiler to go into GC catalepsy,
                        it's slow enough as it is. running in-process causes classpath problems.

                        Taken from Soke POM scala config
                    -->
                    <jvmArgs>
                        <param>-server</param>
                        <!--grabbing memory up front saves us 2 seconds-->
                        <param>-Xms1024M</param>
                        <param>-Xmx1024M</param>

                        <param>-XX:+PrintGC</param>
                        <param>-XX:+PrintGCDetails</param>
                        <param>-XX:+PrintGCTimeStamps</param>
                        <param>-XX:+DisableExplicitGC</param>
                        <param>-XX:+UseParallelOldGC</param>
                    </jvmArgs>

                    <!--

                    Seems to really increase compile speed.  A lot!!!

                    -->
                    <recompileMode>incremental</recompileMode>
                    <useZincServer>true</useZincServer>
                    <javacArgs>
                        <javacArg>-Xlint:unchecked</javacArg>
                        <javacArg>-Xlint:deprecation</javacArg>
                    </javacArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.twdata.maven</groupId>
                <artifactId>maven-cli-plugin</artifactId>
                <version>1.0.6</version>
                <configuration>
                    <commands>
                        <sc>org.codehaus.mojo:build-helper-maven-plugin:add-source net.alchim31.maven:scala-maven-plugin:add-source net.alchim31.maven:scala-maven-plugin:compile</sc>
                    </commands>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*$*</exclude>
                        <exclude>it/**</exclude>
                        <exclude>at/**</exclude>
                    </excludes>
                    <skip>${skipTests}</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
         - make sure contents of WEB-INF/lib are only changed knowingly. enable by
         - passing -DverifyDependencies to Maven.
        -->
        <profile>
            <id>dependency-tracking</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>verifyDependencies</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-dependency-tracker-plugin</artifactId>
                        <version>1.2.3</version>
                        <executions>
                            <execution>
                                <id>validate-webinf-lib</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                                <configuration>
                                    <failMessage>.
                                        **********************************************************************
                                        The runtime dependencies of jira-auditing-plugin have changed. You need to
                                        review and update dependencies.txt. You can run: mvn3 validate
                                        -DverifyDependencies
                                        **********************************************************************
                                    </failMessage>
                                    <!-- don't nag people about changes they've made in the pom.xml -->
                                    <includeDirectDependencies>true</includeDirectDependencies>

                                    <!-- only include JARs that make it into WEB-INF/lib -->
                                    <includeScope>runtime</includeScope>

                                    <!-- disable checksums, they are broken in CI -->
                                    <validatePomChecksums>false</validatePomChecksums>
                                    <validateArtifactChecksums>false</validateArtifactChecksums>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>pseudo.locale</id>
            <activation>
                <property>
                    <name>!jira.acceptance.tests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>pseudo-loc-maven-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>pseudo-loc</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>pseudo-loc</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <sourceLocale>en_UK</sourceLocale>
                            <targetLocale>en_AQ</targetLocale>
                            <pseudoLocaliseActions>
                                <pseudoLocaliseAction>
                                    <source>
                                        src/main/resources/jira-auditing-plugin.properties
                                    </source>
                                    <target>
                                        ${project.build.directory}/test-classes/jira-auditing-plugin_{loc}.properties
                                    </target>
                                </pseudoLocaliseAction>
                            </pseudoLocaliseActions>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>copy</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>com.atlassian.jira</groupId>
                                            <artifactId>jira-languages</artifactId>
                                            <classifier>en_AQ</classifier>
                                            <version>${project.version}</version>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}/jira/bundled-plugins</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <configuration>
                            <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jira-acceptance-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>jira.acceptance.tests</name>
                </property>
            </activation>
            <properties>
                <aduitLogSkipIts>false</aduitLogSkipIts>
                <skip.antrunner>true</skip.antrunner>
                <skip.npm>true</skip.npm>
                <skip.yarn>true</skip.yarn>
                <skip.bower>true</skip.bower>
                <skip.grunt>true</skip.grunt>
                <skip.gulp>true</skip.gulp>
                <skip.jspm>true</skip.jspm>
                <skip.karma>true</skip.karma>
                <skip.webpack>true</skip.webpack>
            </properties>
        </profile>
        <profile>
            <id>releaseProfile</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
    </profiles>
</project>
