<?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">
    <parent>
        <artifactId>servicedesk-lingo-parent</artifactId>
        <groupId>com.atlassian.servicedesk</groupId>
        <version>3.2.0-134</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <packaging>atlassian-plugin</packaging>

    <artifactId>servicedesk-lingo-plugin</artifactId>
    <name>Service Desk Lingo Plugin</name>
    <description>Plugin for language and internationalisation for Service Desk</description>

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

    <dependencies>
        <!-- Atlassian Platform dependencies -->
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
        </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>

        <!-- JIRA -->
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- SD -->
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-servicedesk-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Atlassian Pocketknife -->
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-core</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <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>
            </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="%SD_LINGO_BUILD_DATE@" value="${timestamp}" />
                                <replace file="${project.build.outputDirectory}/buildprops/BuildProperties.properties" token="%SD_LINGO_VERSION@" value="${project.version}" />
                                <replace file="${project.build.outputDirectory}/buildprops/BuildProperties.properties" token="%SD_LINGO_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>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                    <closureJsCompiler>true</closureJsCompiler>
                    <compressResources>false</compressResources>
                    <enableFastdev>false</enableFastdev>
                    <enableDevToolbox>false</enableDevToolbox>
                    <systemPropertyVariables>
                        <plugin.resource.directories>${basedir}/target/classes</plugin.resource.directories>
                    </systemPropertyVariables>
                    <instructions>
                        <Atlassian-Plugin-Key>com.atlassian.servicedesk.servicedesk-lingo-plugin</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>com.atlassian.servicedesk.servicedesk-lingo-plugin</Bundle-SymbolicName>
                        <Spring-Context>*</Spring-Context>
                        <Export-Package>
                        </Export-Package>
                        <Import-Package>
                            !org.springframework.osgi.service.exporter.support,
                            !org.springframework.osgi.service.importer.support,
                            !com.atlassian.refapp.api,
                            !net.sf.cglib.proxy,
                            !org.jvnet.hudson.annotation_indexer,

                            com.atlassian.servicedesk.internal.api.condition,
                            <!-- BND cannot find this runtime dependency of the Atlassian plugin system -->

                            <!--Then other mandatory imports -->
                            <!-- None yet -->

                            <!-- if you declare a com.atlassian.plugin.osgi.external.SingleModuleDescriptorFactory, in your code at runtime the actual -->
                            <!-- package that will be called is com.atlassian.plugin.osgi.bridge.external.SingleModuleDescriptorFactory -->
                            <!-- JIRA 7 and platform 4 use Gemini while the old uses SpringDM -->

                            <!-- At build time the BND plugin will expand this * into the actual packages your code needs access to by analyzing -->
                            <!-- all of your code and it's dependencies through byte code scanning -->
                            *
                        </Import-Package>
                        <Atlassian-Scan-Folders>servicedesk</Atlassian-Scan-Folders>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>

    </build>
</project>
