<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>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-plugins</artifactId>
        <version>7.1.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>jira-board-plugin</artifactId>
    <name>Atlassian JIRA - Plugins - JIRA Board Plugin</name>
    <description>Boards for JIRA Core</description>
    <packaging>atlassian-plugin</packaging>

    <properties>
        <spring.scanner.version>1.2.11</spring.scanner.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>false</skipTests>
        <skipNpm>false</skipNpm>
    </properties>

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <skipNpm>true</skipNpm>
                <skipTests>true</skipTests>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-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.jira</groupId>
            <artifactId>jira-rest-plugin</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
            <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>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.twdata.maven</groupId>
                <artifactId>maven-cli-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <extractDependencies>false</extractDependencies>
                    <skipManifestValidation>true</skipManifestValidation>
                    <instructions>
                        <Atlassian-Plugin-Key>com.atlassian.jira.jira-board-plugin</Atlassian-Plugin-Key>
                        <!-- Ensure plugin is spring powered - see https://extranet.atlassian.com/x/xBS9hQ -->
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>
                            *;resolution:=optional
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.jira.plugin.board.api
                        </Export-Package>
                    </instructions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${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-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/resources</directory>
                            <includes>
                                <include>lib/*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>exec-npm-install</id>
                        <phase>initialize</phase>
                        <configuration>
                            <workingDirectory>./board</workingDirectory>
                            <executable>python3</executable>
                            <arguments>
                                <argument>./jmake_npm_runner.py</argument>
                                <argument>install</argument>
                            </arguments>
                            <skip>${skipNpm}</skip>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>exec-npm-build</id>
                        <phase>generate-resources</phase>
                        <configuration>
                            <workingDirectory>./board</workingDirectory>
                            <executable>python3</executable>
                            <arguments>
                                <argument>./jmake_npm_runner.py</argument>
                                <argument>run</argument>
                                <argument>build-jira</argument>
                            </arguments>
                            <skip>${skipNpm}</skip>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>exec-npm-tests</id>
                        <phase>test</phase>
                        <configuration>
                            <workingDirectory>./board</workingDirectory>
                            <executable>python3</executable>
                            <arguments>
                                <argument>./jmake_npm_runner.py</argument>
                                <argument>run</argument>
                                <argument>test-maven</argument>
                            </arguments>
                            <skip>${skipTests}</skip>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>