<?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>org.vaadin.addons</groupId>
    <artifactId>googleanalyticstracker</artifactId>
    <packaging>jar</packaging>
    <name>GoogleAnalyticsTracker</name>
    <version>4.0.1</version>
    <!-- No parent specified to be able to make standalone component for Directory -->


    <organization>
           <name>Sami Ekblad</name>
           <url>https://github.com/samie/vaadin-ga-tracker</url>
    </organization>

    <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>10.0.0</vaadin.version>
        <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
        <vaadin.directory.urlIdentifier>googleanalyticstracker</vaadin.directory.urlIdentifier>


        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <!-- 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>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <type>pom</type>
                <scope>import</scope>
                <version>${vaadin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
      <dependency>
          <groupId>com.vaadin</groupId>
          <artifactId>flow-server</artifactId>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>3.1.0</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.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</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.10.4</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>3.0.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>3.0.0</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- Testing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
            </plugin>

            <!-- Publish to Directory -->
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2</version>
              <executions>
                <execution>
                  <id>upload-to-directory</id>
                  <phase>deploy</phase>
                  <goals>
                    <goal>exec</goal>
                  </goals>
                  <configuration>
                    <executable>curl</executable>
                    <arguments>
                      <argument>-F</argument>
                      <argument>file=@target/${project.artifactId}-${project.version}.zip</argument>
                      <argument>https://vaadin.com/vaadincom/directory-service/upload/${vaadin.directory.urlIdentifier}?authKey=${vaadin.directory.key}&amp;releaseNotes=${releaseNotes}</argument>
                    </arguments>
                  </configuration>
                </execution>
              </executions>
            </plugin>
        </plugins>

    </build>

</project>
