<?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>org.esa.snap</groupId>
        <artifactId>snap-desktop</artifactId>
        <version>6.0.8</version>
    </parent>

    <artifactId>snap-application</artifactId>
    <packaging>nbm-application</packaging>

    <name>SNAP Desktop NB Application</name>
    <description>Maven module solely used to launch SNAP Desktop with the NetBeans Platform</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <application.dir>${project.build.directory}/${brandingToken}</application.dir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.netbeans.cluster</groupId>
            <artifactId>platform</artifactId>
            <version>${netbeans.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <!-- excluded this dependency, otherwise it is shown in the auto update center in SNAP -->
                    <groupId>org.netbeans.api</groupId>
                    <artifactId>org-netbeans-libs-testng</artifactId>
                </exclusion>
                <exclusion>
                    <!-- excluded this dependency, otherwise it is shown in the auto update center in SNAP and would create a cluster named 'java' -->
                    <groupId>org.netbeans.modules</groupId>
                    <artifactId>org-netbeans-modules-junitlib</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-engine</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
        <!-- NbModuleSuite functional in RELEASE70 or later: -->
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-nbjunit</artifactId>
            <version>${netbeans.version}</version>
            <scope>test</scope>
            <!-- beyond platform cluster, this often needs to be dropped down to compile/runtime, some other modules in IDE clusters depend on it -->
        </dependency>
        <dependency>
            <groupId>org.netbeans.modules</groupId>
            <artifactId>org-netbeans-modules-extbrowser</artifactId>
            <version>${netbeans.version}</version>
        </dependency>
        <!-- To use Jelly Tools in your functional tests, add or replace with:
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-jellytools-platform</artifactId>
            <version>${netbeans.version}</version>
            <scope>test</scope>
        </dependency>
        -->

        <!-- SNAP project modules -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-branding</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-classification-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-dem-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-engine-kit</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-gpf-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-graph-builder</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-help</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-land-cover-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-product-library</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-raster-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-rcp</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-binning-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-collocation-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-unmix-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-watermask-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>snap-pixel-extraction-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>${project.groupId}</groupId>-->
        <!--<artifactId>snap-scripting</artifactId>-->
        <!--<version>${project.version}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-worldwind</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-sta-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-smart-configurator-ui</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- disabled: these modules don't have the required maturity right now. -->
        <!--<dependency>-->
        <!--<groupId>${project.groupId}</groupId>-->
        <!--<artifactId>snap-opendap-ui</artifactId>-->
        <!--<version>${project.version}</version>-->
        <!--</dependency>-->
        <!--<dependency>-->
        <!--<groupId>${project.groupId}</groupId>-->
        <!--<artifactId>snap-timeseries-ui</artifactId>-->
        <!--<version>${project.version}</version>-->
        <!--</dependency>-->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <configuration>
                    <installerLicenseFile>../LICENSE.html</installerLicenseFile>
                    <etcConfFile>${application.dir}/etc/snap.conf</etcConfFile>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
            </plugin>
            <!-- Permits NbModuleSuite to be run in integration-test phase: -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.2</version>
                <configuration>
                    <!-- currently the application test fails during initialisation of JAI-->
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>copy-conf-files</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${application.dir}/etc</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>../etc</directory>
                                    <filtering>true</filtering>
                                </resource>
                                <resource>
                                    <directory>../../snap-engine/etc</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution> <!-- actuallly not nice to copy the resources from the engine here -->
                        <id>copy-version-file</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${application.dir}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>../../snap-engine</directory>
                                    <includes>
                                        <include>VERSION.txt</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.esa.snap</groupId>
                                    <artifactId>snap-main</artifactId>
                                    <version>${project.version}</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/snap/snap/core</outputDirectory>
                                    <destFileName>snap-main.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>deployment</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>nbm-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>extra</id>
                                <goals>
                                    <goal>autoupdate</goal>
                                    <goal>build-installers</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
