<?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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>eu.maxschuster</groupId>
    <artifactId>vaadin-signaturefield</artifactId>
    <packaging>bundle</packaging>
    <version>2.0.1</version>
    
    <name>SignatureField</name>
    <description>Vaadin field to capture signatures.</description>
    <url>https://github.com/maxschuster/Vaadin-SignatureField</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>8.0.5</vaadin.version>
        <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>

        <!-- grunt settings -->
        <grunt.sourceDirectory>src/main/grunt</grunt.sourceDirectory>
        <grunt.jsSourceDirectory>signaturefield</grunt.jsSourceDirectory>
        <grunt.gruntBuildDirectory>${basedir}/target-grunt</grunt.gruntBuildDirectory>
        <grunt.warTargetDirectory>classes/VAADIN/addons/signaturefield</grunt.warTargetDirectory>

        <!-- ZIP Manifest fields -->
        <Implementation-Version>${project.version}</Implementation-Version>
        <!-- Must not change this because of the Directory -->
        <Implementation-Title>${project.name}</Implementation-Title>
        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
        <Vaadin-License-Title>Apache License 2.0</Vaadin-License-Title>
        <Vaadin-Addon>${project.artifactId}-${project.version}.jar</Vaadin-Addon>
    </properties>
    
    <organization>
        <name>Max Schuster</name>
        <url>https://github.com/maxschuster/</url>
    </organization>
    
    <developers>
        <developer>
            <name>Max Schuster</name>
            <email>dev@maxschuster.eu</email>
            <url>https://github.com/maxschuster</url>
            <id>maxschuster</id>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/maxschuster/Vaadin-SignatureField.git</url>
        <connection>scm:git:https://github.com/maxschuster/Vaadin-SignatureField.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:maxschuster/Vaadin-SignatureField.git</developerConnection>
        <tag>${project.version}}</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/maxschuster/Vaadin-SignatureField/issues</url>
    </issueManagement>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-server</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-client</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>
		
        <!-- This can be replaced with TestNG or some other test framework supported by the surefire plugin -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!-- Add servlet api to tests so NoClassDefFoundErrors are thrown -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>eu.maxschuster</groupId>
            <artifactId>dataurl</artifactId>
            <version>2.0.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>pl.allegro</groupId>
                <artifactId>grunt-maven-plugin</artifactId>
                <version>1.5.1</version>
                <configuration>
                    <showColors>true</showColors>
                    <gruntOptions></gruntOptions>
                    <sourceDirectory>${grunt.sourceDirectory}</sourceDirectory>
                    <jsSourceDirectory>${grunt.jsSourceDirectory}</jsSourceDirectory>
                    <gruntBuildDirectory>${grunt.gruntBuildDirectory}</gruntBuildDirectory>
                    <warTargetDirectory>${grunt.warTargetDirectory}</warTargetDirectory>
                    <gruntOptions></gruntOptions>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>clean</goal>
                            <goal>create-resources</goal>
                            <goal>npm</goal>
                            <!-- or npm-offline if npm failure is not an option -->
                            <goal>grunt</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <!-- Package format version - do not change -->
                            <Vaadin-Package-Version>1</Vaadin-Package-Version>
                            <Vaadin-License-Title>${Vaadin-License-Title}</Vaadin-License-Title>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
			
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- Testing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.14.1</version>
            </plugin>
            
            <!-- OSGi -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <version>3.0.0</version>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Export-Package>
                            !eu.maxschuster.vaadin.signaturefield.client,
                            eu.maxschuster.vaadin.signaturefield,
                            eu.maxschuster.vaadin.signaturefield.converter,
                            eu.maxschuster.vaadin.signaturefield.shared
                        </Export-Package>
                        <Import-Package>!com.google.gwt.*,!com.vaadin.client.*,*</Import-Package>
                        <_noee>true</_noee>
                        <Include-Resource>
                            {maven-resources}, {maven-dependencies},
                            VAADIN/addons/signaturefield=target/classes/VAADIN/addons/signaturefield
                        </Include-Resource>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            
            
        </plugins>

        <!-- This is needed for the sources required by the client-side compiler to be 
        included in the produced JARs -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>rebel.xml</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/grunt</directory>
                <excludes>
                    <exclude>**</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
		
    </build>
    
    <profiles>
        <profile>
            <id>ossrh</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.5</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
