<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
         xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.vaadin</groupId>    
    <artifactId>vaadin-spreadsheet-charts</artifactId>
    <version>3.1.1</version>

    <packaging>jar</packaging>
    <name>Vaadin Spreadsheet Charts Integration</name>  
    <inceptionYear>2016</inceptionYear>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <currentYear>2026</currentYear>
        
        <vaadin.version>8.14.4</vaadin.version>
        <charts.version>4.3.5</charts.version>
        <testbench.version>5.1.2</testbench.version>
        <jetty.version>9.4.54.v20240208</jetty.version>
        <poi.version>5.2.2</poi.version>
        
        <javax.servlet.version>3.0.1</javax.servlet.version>
        <junit.version>4.13.2</junit.version>

        <testbench.api.version>${vaadin.version}</testbench.api.version>
        <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
    </properties>

    <organization>
        <name>Vaadin Ltd</name>
        <url>https://vaadin.com</url>
    </organization>
    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
        </repository>
        <repository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <name>Vaadin Pre-releases</name>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <snapshotRepository>
            <id>vaadin-prereleases</id>
            <name>Vaadin Pre-releases</name>
            <url>https://maven.vaadin.com/vaadin-prereleases/</url>
        </snapshotRepository>
        <repository>
            <id>vaadin-addons</id>
            <name>Vaadin add-ons repository</name>
            <url>https://tools.vaadin.com/nexus/content/repositories/vaadin-addons</url>
        </repository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spreadsheet</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-charts</artifactId>
            <version>${charts.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${javax.servlet.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>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spreadsheet-testbench-api</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <version>${testbench.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench-api</artifactId>
            <version>${testbench.api.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.12.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
                <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>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                <configuration>
                    <webappDirectory>${project.build.directory}/testwebapp/VAADIN/widgetsets</webappDirectory>
                    <extraJvmArgs>-Xms512M -Xmx1g</extraJvmArgs>
                    <hostedWebapp>${project.build.directory}/testwebapp</hostedWebapp>
                    <noServer>true</noServer>
                    <runTarget>http://localhost:9998/</runTarget>
                    <draftCompile>true</draftCompile>
                    <style>PRETTY</style>
                    <compileReport>true</compileReport>
                    <strict>true</strict>

                    <module>com.vaadin.addon.spreadsheet.charts.WidgetSet</module>
                </configuration>
                <executions>
                    <!-- You are free to mark this as permanently ignored in Eclipse -->
                    <execution>
                        <configuration>
                            <!-- if you don't specify any modules, the plugin will find them -->
                        </configuration>
                        <goals>
                            <goal>resources</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <!-- Clean-up widgetset required for "inplace" compilation -->
                            <directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
                        </fileset>
                        <fileset>
                            <!-- Clean-up gwt cache -->
                            <directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <webResources>
                        <webResource>
                            <targetpath>testwebapp</targetpath>
                        </webResource>
                    </webResources>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <excludes>
                        <exclude>
                            *TBTest.java
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <includes>
                        <include>**/*TBTest.java</include>
                    </includes>
                    <excludes>
                        <!-- Files here might match to naming conventions, but the are just
                            vaadin apps containing your add-on components in various setups. We can ignore
                            them from test. -->
                        <exclude>**/demoandtestapp/**/*</exclude>
                        <exclude>**/Abstract*</exclude>
                        <exclude>**/junit/*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>failsafe-integration-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>failsafe-verify</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <httpConnector>
                        <port>9998</port>
                    </httpConnector>
                    <useTestClasspath>true</useTestClasspath>
                    <useTestScope>true</useTestScope>
                    <supportedPackagings>jar</supportedPackagings>
                    <stopKey>STOP</stopKey>
                    <stopPort>8005</stopPort>
                    <webAppConfig>
                        <webInfIncludeJarPattern>
                            .*vaadin.*
                        </webInfIncludeJarPattern>
                        <contextPath>/</contextPath>
                        <resourceBases>
                            <resourceBase>${project.build.directory}/testwebapp</resourceBase>
                            <!--Vaadin classloader can't find the theme without this-->
                            <resourceBase>${project.build.outputDirectory}</resourceBase>
                        </resourceBases>
                    </webAppConfig>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.vaadin</groupId>
                                        <artifactId>vaadin-maven-plugin</artifactId>
                                        <versionRange>
                                            [${vaadin.plugin.version},)
                                        </versionRange>
                                        <goals>
                                            <goal>resources</goal>
                                            <goal>update-widgetset</goal>
                                            <goal>compile</goal>
                                            <goal>update-theme</goal>
                                            <goal>compile-theme</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>rebel.xml</exclude>
                </excludes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/webapp</directory>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>verify-only-phantom</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <browsers.include>phantomjs2</browsers.include>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>verify-local-phantom</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <localPhantom>true</localPhantom>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>start-jetty-for-it</id>
            <activation>
                <property>
                    <name>skipTests</name>
                    <value>!true</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-spreadsheet</artifactId>
                    <version>${project.version}</version>
                    <type>test-jar</type>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <executions>
                            <!-- start and stop jetty (running our app) when running integration
                                 tests -->
                            <execution>
                                <id>start-jetty</id>
                                <phase>pre-integration-test</phase>

                                <goals>
                                    <goal>start</goal>
                                </goals>
                                <configuration>
                                    <scanIntervalSeconds>0</scanIntervalSeconds>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-jetty</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.12.1</version>
                        <configuration>
                            <encoding>UTF-8</encoding>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default-testCompile</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>
                                    <skip>false</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Profile for updating license headers. -->
            <id>license</id>
            
            <build>
                <plugins>
                    <plugin> 
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <version>4.3</version>
                        <configuration>
                            <header>src/license/header.txt</header>
                            <quiet>false</quiet>
                            <failIfMissing>true</failIfMissing>
                            <aggregate>false</aggregate>
                            <useDefaultExcludes>true</useDefaultExcludes>
                            <useDefaultMapping>true</useDefaultMapping>
                            <encoding>UTF-8</encoding>
                            <properties>
                                <year>${currentYear}</year>
                            </properties>
                            <includes>
                                <include>/**/*.java</include>
                                <include>*.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
