<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.whisper</groupId>
        <artifactId>atlassian-whisper-parent</artifactId>
        <version>1.1.12</version>
    </parent>

    <artifactId>atlassian-whisper-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian Notifications</name>
    <description>Provides targeted notifications within the product, primarily informing admins about new releases and upcoming maintenance renewals.</description>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.whisper</groupId>
            <artifactId>atlassian-whisper-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <version>1.16.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>

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

        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
            <version>${atlassian.scheduler.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <scope>provided</scope>
            <version>1.1</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.1</version>
        </dependency>

        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-client-lib</artifactId>
            <version>5.2.20</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.ozymandias</groupId>
            <artifactId>atlassian-plugin-point-safety</artifactId>
            <scope>compile</scope>
            <version>0.10</version>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.whisper</groupId>
            <artifactId>atlassian-whisper-testkit</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.whisper</groupId>
            <artifactId>atlassian-whisper-backdoor-plugin</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <version>${analytics.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <version>${atlassian.event.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webfragment-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-api</artifactId>
            <scope>provided</scope>
            <version>4.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib-nodep</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
            <version>0.9</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>postgres</id>
            <activation>
                <property>
                    <name>postgres</name>
                    <value />
                </property>
            </activation>
            <properties>
                <refapp.jdbc.external>true</refapp.jdbc.external>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-amps-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <products>
                        <product>
                            <id>jira</id>
                            <version>${jira.version}</version>
                            <productDataVersion>${jira.data.version}</productDataVersion>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.whisper</groupId>
                                    <artifactId>atlassian-whisper-backdoor-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.tests</groupId>
                                    <artifactId>jira-testkit-plugin</artifactId>
                                    <version>${jira.testkit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-func-test-plugin</artifactId>
                                    <version>${jira.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.plugins.jstestrunner</groupId>
                                    <artifactId>atlassian-jstest-runner-plugin</artifactId>
                                    <version>${atlassian.jstestsrunner.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                        </product>
                        <product>
                            <id>confluence</id>
                            <version>${confluence.version}</version>
                            <productDataVersion>${confluence.data.version}</productDataVersion>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.whisper</groupId>
                                    <artifactId>atlassian-whisper-backdoor-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.qunit</groupId>
                                    <artifactId>atlassian-qunit-plugin</artifactId>
                                    <version>${atlassian.qunit.version}</version>
                                </pluginArtifact>
                                <!-- remove this once bump of whitelist lands in confluence:
                                     https://stash.atlassian.com/projects/CONFSERVER/repos/confluence/pull-requests/2565/overview -->
                                <pluginArtifact>
                                    <groupId>com.atlassian.analytics</groupId>
                                    <artifactId>analytics-whitelist</artifactId>
                                    <version>3.62</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                        </product>
                        <product>
                            <id>refapp</id>
                            <version>${refapp.version}</version>
                            <systemProperties>
                                <refapp.jdbc.external>${refapp.jdbc.external}</refapp.jdbc.external>
                                <refapp.jdbc.driver.class.name>${refapp.jdbc.driver.class.name}</refapp.jdbc.driver.class.name>
                                <refapp.jdbc.app.url>${refapp.jdbc.app.url}</refapp.jdbc.app.url>
                                <refapp.jdbc.app.schema>${refapp.jdbc.app.schema}</refapp.jdbc.app.schema>
                                <refapp.jdbc.app.user>${refapp.jdbc.app.user}</refapp.jdbc.app.user>
                                <refapp.jdbc.app.pass>${refapp.jdbc.app.pass}</refapp.jdbc.app.pass>
                                <refapp.jdbc.validation.query>${refapp.jdbc.validation.query}</refapp.jdbc.validation.query>
                            </systemProperties>
                            <libArtifacts>
                                <libArtifact>
                                    <groupId>${jdbc.groupId}</groupId>
                                    <artifactId>${jdbc.artifactId}</artifactId>
                                    <version>${jdbc.version}</version>
                                </libArtifact>
                            </libArtifacts>
                            <!-- The refapp doesn't include a few key jars that the rest of the
                                products do, so we add them manually during the deployment -->
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.aui</groupId>
                                    <artifactId>auiplugin</artifactId>
                                    <version>${refapp.aui.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.whisper</groupId>
                                    <artifactId>atlassian-whisper-backdoor-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.plugins.jstestrunner</groupId>
                                    <artifactId>atlassian-jstest-runner-plugin</artifactId>
                                    <version>${atlassian.jstestsrunner.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                        </product>
                    </products>
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>

                    <log4jProperties>src/test/resources/log4j.properties</log4jProperties>

                    <systemPropertyVariables>
                        <plugin.resource.directories>${basedir}/src/main/resources,${project.build.directory}/classes</plugin.resource.directories>
                        <user.language>${user.language}</user.language>
                        <user.region>${user.region}</user.region>
                        <atlassian.whisper.delivery.endpoint>${whisper.delivery.endpoint}</atlassian.whisper.delivery.endpoint>
                        <atlassian.whisper.fetch.scheduler.interval>${whisper.fetch.scheduler.interval}</atlassian.whisper.fetch.scheduler.interval>
                        <atlassian.whisper.fetch.scheduler.delay>${whisper.fetch.scheduler.delay}</atlassian.whisper.fetch.scheduler.delay>
                        <atlassian.whisper.fetch.expiry.time-to-live>${whisper.fetch.expiry.time-to-live}</atlassian.whisper.fetch.expiry.time-to-live>
                        <atlassian.whisper.disable.signatures.verification>${whisper.disable.signatures.verification}</atlassian.whisper.disable.signatures.verification>
                    </systemPropertyVariables>

                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

                        <Export-Package>
                            com.atlassian.whisper.plugin.api,
                        </Export-Package>

                        <!-- Add package import here -->
                        <Import-Package>
                            com.atlassian.plugin.osgi.bridge.external,
                            *;version="0";resolution:=optional
                        </Import-Package>

                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <!-- Install npm modules and run ESLint -->
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <nodeVersion>v6.9.4</nodeVersion>
                    <npmVersion>3.10.10</npmVersion>
                    <installDirectory>${node.install.directory}</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install-hermes-modules</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                            <workingDirectory>${hermes.directory}</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>webpack-hermes-modules</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run webpack -- --outputPath=${project.build.outputDirectory}/vendor</arguments>
                            <workingDirectory>${hermes.directory}</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-npm-modules</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install --production</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-npm-dev-modules</id>
                        <phase>test</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                            <skip>${eslint.skip}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-eslint</id>
                        <phase>test</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run lint -- --save ${project.build.directory}/results.eslint.txt</arguments>
                            <skip>${eslint.skip}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>${npm.command}</executable>
                    <!-- optional -->
                    <workingDirectory>${hermes.directory}</workingDirectory>
                    <async>true</async>
                    <asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
                    <arguments>
                        <argument>run</argument>
                        <argument>watch</argument>
                        <argument>--</argument>
                        <argument>--outputPath</argument>
                        <argument>${project.build.outputDirectory}/vendor</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>**/*.properties</exclude>
                </excludes>
            </resource>
        </resources>
    </build>

    <properties>
        <atlassian.scheduler.version>1.7.0</atlassian.scheduler.version>
        <analytics.version>5.2.0</analytics.version>
        <atlassian.event.version>3.1.3</atlassian.event.version>

        <!-- hermes -->
        <hermes.directory>${basedir}/../hermes</hermes.directory>

        <!-- node and npm -->
        <node.install.directory>${basedir}/.node</node.install.directory>
        <node.directory>${node.install.directory}/node</node.directory>
        <node.command>${node.directory}/node</node.command>
        <npm.command>${node.directory}/npm</npm.command>

        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>

        <whisper.fetch.scheduler.interval>60000</whisper.fetch.scheduler.interval>
        <whisper.fetch.scheduler.delay>0</whisper.fetch.scheduler.delay>
        <whisper.fetch.expiry.time-to-live>180000</whisper.fetch.expiry.time-to-live>

        <jdbc.groupId>org.postgresql</jdbc.groupId>
        <jdbc.artifactId>postgresql</jdbc.artifactId>
        <jdbc.version>9.3-1100-jdbc41</jdbc.version>

        <!-- when running refapp with external db, postgres is the default -->
        <db.host>localhost</db.host>
        <refapp.jdbc.external>false</refapp.jdbc.external>
        <refapp.jdbc.driver.class.name>org.postgresql.Driver</refapp.jdbc.driver.class.name>
        <refapp.jdbc.app.url>jdbc:postgresql://${db.host}:5432/jira</refapp.jdbc.app.url>
        <refapp.jdbc.app.user>jira</refapp.jdbc.app.user>
        <refapp.jdbc.app.pass>jira</refapp.jdbc.app.pass>
        <refapp.jdbc.validation.query>SELECT 1</refapp.jdbc.validation.query>
        <refapp.jdbc.app.schema>public</refapp.jdbc.app.schema>

        <whisper.disable.signatures.verification>true</whisper.disable.signatures.verification>
    </properties>

</project>
