<?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>eu.agrosense.apps</groupId>
        <artifactId>parent</artifactId>
        <version>14.02-beta</version>
    </parent>

    <artifactId>launcher</artifactId>
    <packaging>jar</packaging>

    <name>agrosense-launcher</name>

    <properties>
        <mainClass>eu.agrosense.apps.launcher.MainApp</mainClass>
    </properties>

    <build>
        <plugins>
            <!-- keep the old unpack call for a while in case we need to compare contents -->
            <!--
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeScope>system</excludeScope>
                            <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                            <outputDirectory>${project.build.directory}/unpacked-old</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>-->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly-unpack-dependencies.xml</descriptor>
                            </descriptors>
                            <finalName>unpacked4jfx</finalName>
                            <!-- use only finalName as unpack dir name: -->
                            <appendAssemblyId>false</appendAssemblyId>
                            <attach>false</attach>
                            <!-- TODO: share the descriptor via an artifact, as the standalone versions of the apps will need the same -->
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${java.home}/../bin/javafxpackager</executable>
                            <arguments>
                                <argument>-createjar</argument>
                                <argument>-nocss2bin</argument>
                                <argument>-appclass</argument>
                                <argument>${mainClass}</argument>
                                <argument>-srcdir</argument>
                                <argument>${project.build.directory}/unpacked4jfx</argument>
                                <argument>-outdir</argument>
                                <argument>${project.build.directory}</argument>
                                <argument>-outfile</argument>
                                <argument>${project.build.finalName}.jar</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>  
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <additionalClasspathElements>
                        <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>            
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.jfxtras</groupId>
            <artifactId>jfxtras-labs</artifactId>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.api</groupId>
            <artifactId>style</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.spi</groupId>
            <artifactId>style-greenish</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.api</groupId>
            <artifactId>session</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.spi</groupId>
            <artifactId>session</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.spi</groupId>
            <artifactId>activity</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>eu.agrosense.api</groupId>
            <artifactId>widget</artifactId>
            <version>${agrosense.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>eu.agrosense.apps</groupId>
                    <artifactId>timesheet</artifactId>
                    <version>${project.version}</version>
                </dependency>
                <dependency>
                    <groupId>eu.agrosense.apps</groupId>
                    <artifactId>activity</artifactId>
                    <version>${project.version}</version>
                </dependency>                
            </dependencies>
        </profile>
    </profiles>
</project>
