<?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">

    <parent>
        <groupId>com.atlassian.servicedesk</groupId>
        <artifactId>jira-workinghours-parent-pom</artifactId>
        <version>3.6.0-QR-0029</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jira-workinghours-plugin</artifactId>

    <name>JIRA Working Hours Plugin</name>
    <description>JIRA Working Hours Plugin</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-workinghours-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-servicedesk-internal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>jira-pocketknife-enablement</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>jira-pocketknife-ao-dao</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>jira-pocketknife-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-querydsl</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-dynamic-modules</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.annotations</groupId>
            <artifactId>atlassian-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>

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

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

        <dependency>
            <groupId>com.atlassian.vcache</groupId>
            <artifactId>atlassian-vcache-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.joda</groupId>
            <artifactId>joda-convert</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>provided</scope>
        </dependency>

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

        <!-- REST module dependencies -->
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-step</artifactId>
        </dependency>

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

        <!-- Spring dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Unit test dependencies -->
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-test</artifactId>
            <version>${ao.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>javax.servlet</artifactId>
                    <groupId>servlet-api</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <!-- gadgets bring in guice 1.0 - fail -->
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>3.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <!--
                         These frontend resources are copied across to target/classes
                         See: gulpfile.js
                     -->
                    <exclude>**/*.js</exclude>
                    <exclude>**/*.less</exclude>
                    <exclude>**/*.css</exclude>
                    <exclude>**/*.soy</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>com.atlassian.util</groupId>
                <artifactId>db-schema-translator-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>atlassian-pocketknife-core</artifactId>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>jira-pocketknife-enablement</artifactId>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>jira-pocketknife-ao-dao</artifactId>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>jira-pocketknife-rest</artifactId>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>atlassian-pocketknife-querydsl</artifactId>
                        </dependency>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>atlassian-pocketknife-dynamic-modules</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <!-- Generate build properties -->
                    <execution>
                        <id>generate-build-properties</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />

                                <echo>  Running ant tasks.  Suck on that maven!</echo>

                                <echo>  Generating BuildProperties.properties...</echo>

                                <copy file="${project.basedir}/src/main/resources/buildprops/BuildProperties.properties.template" tofile="${project.build.outputDirectory}/buildprops/BuildProperties.properties" overwrite="true" />
                                <replace file="${project.build.outputDirectory}/buildprops/BuildProperties.properties" token="%JIRA_WORKING_HOURS_BUILD_DATE@" value="${timestamp}" />
                                <replace file="${project.build.outputDirectory}/buildprops/BuildProperties.properties" token="%JIRA_WORKING_HOURS_VERSION@" value="${project.version}" />
                                <replace file="${project.build.outputDirectory}/buildprops/BuildProperties.properties" token="%JIRA_WORKING_HOURS_CHANGE_SET@" value="${buildNumber}" />

                            </target>
                        </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>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <!-- Copy license files -->
                    <execution>
                        <id>copy-licenses</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/licenses</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>
                                    <directory>../licenses</directory>
                                    <includes>
                                        <include>*.txt</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <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>

            <!--
            This config is the guy who builds most of the JIRA plugin magic from our day to day point of view

            Be deliberate about what you change here and why you do it

            -->
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <closureJsCompiler>true</closureJsCompiler>
                    <compressResources>false</compressResources>
                    <systemPropertyVariables>
                        <plugin.resource.directories>${basedir}/target/classes</plugin.resource.directories>
                    </systemPropertyVariables>
                    <instructions>
                        <Atlassian-Plugin-Key>com.atlassian.jira.plugins.workinghours</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>com.atlassian.jira.plugins.workinghours</Bundle-SymbolicName>
                        <Spring-Context>*</Spring-Context>

                        <!-- Specifies the location of standard plugin modules to scan -->
                        <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
                        <Private-Package>
                        </Private-Package>

                        <Export-Package>
                            com.atlassian.jira.plugins.workinghours.internal.obr.install,
                            com.atlassian.jira.plugins.workinghours.api;version="${project.version}",
                            com.atlassian.jira.plugins.workinghours.api.*;version="${project.version}",
                            com.atlassian.jira.plugins.workinghours.spi;version="${project.version}",
                            com.atlassian.jira.plugins.workinghours.spi.*;version="${project.version}",
                        </Export-Package>

                        <!--optionals first, in alphabetic order, followed by mandatories, in alphabetic order-->
                        <Import-Package>
                            !com.atlassian.jira.plugins.workinghours.api,
                            !com.atlassian.jira.plugins.workinghours.api.*,
                            !com.atlassian.jira.plugins.workinghours.spi.,
                            !com.atlassian.jira.plugins.workinghours.spi.*,

                            !net.sf.cglib.proxy,
                            !org.jvnet.hudson.annotation_indexer,
                            !org.joda.convert,

                            <!-- Mandatory imports than won't be picked up by BND-->
                            <!-- without them we break or are flaky at best -->

                            com.atlassian.jira.entity,
                            com.atlassian.fugue,

                            <!-- needed for ModuleType -->
                            com.atlassian.plugin.osgi.bridge.external,

                            <!-- declare import for javax.annotation here so @PostConstruct can be used -->
                            javax.annotation,

                            *
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.version}</version>
                    <configuration>
                        <excludes>
                            <exclude>**/*$*</exclude>
                            <exclude>it/**</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>maven-amps-dispatcher-plugin</artifactId>
                    <version>${amps.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <properties>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss.SSSZ</maven.build.timestamp.format>
        <timestamp>${maven.build.timestamp}</timestamp>
        <buildNumber/>
    </properties>

</project>
