<?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>com.vaadin</groupId>
        <artifactId>vaadin-root</artifactId>
        <version>8.0-SNAPSHOT</version>
    </parent>
    <artifactId>vaadin-server</artifactId>
    <name>vaadin-server</name>
    <packaging>jar</packaging>

    <url>https://vaadin.com/</url>
    <description>Vaadin server</description>

    <dependencies>
        <!-- API DEPENDENCIES -->

        <!-- Liferay Portal Service -->
        <dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>portal-service</artifactId>
            <version>${liferay.portal-service.version}</version>
            <scope>provided</scope>
        </dependency>

        <!--Servlet API -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--Portlet API -->
        <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Bean Validation API -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <!-- Sass compiler -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>vaadin-sass-compiler</artifactId>
        </dependency>

        <!-- LIBRARY DEPENDENCIES (compile time) -->
        <!-- Project modules -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>vaadin-shared</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>vaadin-push</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-icons</artifactId>
        </dependency>

        <!-- Jsoup for BootstrapHandler -->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
        </dependency>

        <!-- Small reflection library -->
        <dependency>
            <groupId>com.googlecode.gentyref</groupId>
            <artifactId>gentyref</artifactId>
            <version>1.2.0</version>
        </dependency>

        <!-- TESTING DEPENDENCIES -->

        <!-- Test dependencies -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- For manual testing with PostgreSQL (see SQLTestConstants) -->
        <!-- <dependency><groupId>postgresql</groupId><artifactId>postgresql</artifactId><version>9.1-901.jdbc3</version></dependency> -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>copy-font-icons</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <!-- VaadinIcons.java file -->
                        <configuration>
                            <includeGroupIds>com.vaadin</includeGroupIds>
                            <includeArtifactIds>vaadin-icons</includeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                            <includes>com/vaadin/icons/VaadinIcons.java</includes>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/vaadin-icons</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/vaadin-icons</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>

                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <!-- Copy .java files to package -->
                    <execution>
                        <id>copy-sources</id>
                        <!-- here the phase you need -->
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>false</filtering>
                                </resource>
                                <resource>
                                    <directory>src/main/java</directory>
                                    <filtering>false</filtering>
                                </resource>
                                <resource>
                                    <directory>${project.build.directory}/vaadin-icons</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compressbootstrap</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <property name="vaadinBootstrap.js"
                                    location="${project.build.outputDirectory}/VAADIN/vaadinBootstrap.js" />

                                <!-- Gzipped version -->
                                <gzip src="${vaadinBootstrap.js}"
                                    destfile="${vaadinBootstrap.js}.gz" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-RequiredExecutionEnvironment>${osgi.execution.environment}</Bundle-RequiredExecutionEnvironment>
                        <Bundle-Version>${osgi.bundle.version}</Bundle-Version>
                        <Export-Package>VAADIN;version="${osgi.bundle.version}",com.vaadin.*;version="${osgi.bundle.version}"</Export-Package>
                        <!-- Note that Liferay 6 does not use OSGi, and the dependency is optional for non-Liferay deployments -->
                        <Import-Package>javax.servlet;version="${osgi.javax.servlet.version}",
                            javax.servlet.http;version="${osgi.javax.servlet.version}",
                            javax.validation;version="${javax.validation.version}";resolution:=optional,
                            org.jsoup;version="${jsoup.version}",
                            org.jsoup.parser;version="${jsoup.version}",
                            org.jsoup.nodes;version="${jsoup.version}",
                            org.jsoup.helper;version="${jsoup.version}",
                            org.jsoup.safety;version="${jsoup.version}",
                            org.jsoup.select;version="${jsoup.version}",
                            javax.portlet;version="[${javax.portlet.version},3)";resolution:=optional,
                            javax.portlet.filter;version="[${javax.portlet.version},3)";resolution:=optional,
                            com.liferay.portal.kernel.util;version="[7,8)";resolution:=optional</Import-Package>
                        <Require-Bundle>
                            com.vaadin.shared;bundle-version="${osgi.bundle.version}",
                            com.vaadin.push;bundle-version="${osgi.bundle.version}";resolution:=optional,
                            com.vaadin.sass-compiler;bundle-version="${vaadin.sass.version}";resolution:=optional</Require-Bundle>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <index>false</index>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
                <!-- Package src/test into a jar so that compatbility-server 
                    can use the same test classes, e.g. test beans -->
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
        </plugins>
        
        <pluginManagement>
            <plugins>
                <!-- Make Eclipse add the source folder -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>build-helper-maven-plugin</artifactId>
                                        <versionRange>[1.0,)</versionRange>
                                        <goals>
                                            <goal>add-source</goal>
<!--
                                            <goal>add-test-source</goal>
                                            <goal>add-resource</goal>
                                            <goal>add-test-resource</goal>
                                            <goal>maven-version</goal>
                                            <goal>parse-version</goal>
-->
                                         </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute>
                                            <runOnConfiguration>true</runOnConfiguration>
                                            <!-- <runOnIncremental>true</runOnIncremental> -->
                                        </execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    
</project>