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

    <artifactId>flow-component-base</artifactId>
    <version>2.2.0</version>
    <packaging>pom</packaging>
    <name>Flow component base</name>
    <description>Parent pom for individual component modules</description>

    <parent>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-parent</artifactId>
        <version>2.0.1</version>
    </parent>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8
        </project.reporting.outputEncoding>

        <jetty.version>9.4.15.v20190215</jetty.version>
        <maven.failsafe.plugin.version>2.20</maven.failsafe.plugin.version>
        <maven.resources.plugin.version>3.0.2</maven.resources.plugin.version>
        <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
        <driver.binary.downloader.maven.plugin.version>1.0.14
        </driver.binary.downloader.maven.plugin.version>
        <flow.version>2.2.0</flow.version>
        <testbench.version>6.2.2</testbench.version>

        <!-- OSGi support -->
        <osgi.bundle.import.package>*</osgi.bundle.import.package>
        <osgi.bundle.export.package>com.vaadin.flow.component.*;-noimport:=true</osgi.bundle.export.package>
        <osgi.bundle.required.execution.environment>JavaSE-1.8</osgi.bundle.required.execution.environment>
        <osgi.bundle.license>http://www.apache.org/licenses/LICENSE-2.0</osgi.bundle.license>
        <osgi.bundle.name>${project.artifactId}</osgi.bundle.name>
        <osgi.bundle.symbolic.name>${project.groupId}.flow.component.${component.package.name}</osgi.bundle.symbolic.name>
        <osgi.bundle.package.private></osgi.bundle.package.private>
        <osgi.bundle.bundle.activator></osgi.bundle.bundle.activator>
        <osgi.bundle.description></osgi.bundle.description>
    </properties>

    <distributionManagement>
        <repository>
            <id>vaadin-staging</id>
            <name>Vaadin release staging repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>vaadin-snapshots</id>
            <name>Vaadin snapshot repository</name>
            <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>vaadin-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>vaadin-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <quiet>true</quiet>
                        <doclint>none</doclint>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>4.1.0</version>
                    <extensions>true</extensions>
                    <executions>
                        <execution>
                            <id>bundle-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <exportScr>true</exportScr>
                        <instructions>
                            <Bundle-Name>${osgi.bundle.name}</Bundle-Name>
                            <Bundle-SymbolicName>${osgi.bundle.symbolic.name}</Bundle-SymbolicName>
                            <Import-Package>${osgi.bundle.import.package}</Import-Package>
                            <Export-Package>${osgi.bundle.export.package}</Export-Package>
                            <Private-Package>${osgi.bundle.package.private}</Private-Package>
                            <Bundle-Activator>${osgi.bundle.bundle.activator}</Bundle-Activator>
                            <Bundle-License>${osgi.bundle.license}</Bundle-License>
                            <Bundle-Description>${osgi.bundle.description}</Bundle-Description>
                            <_removeheaders>Built-By</_removeheaders>
                            <!-- Enable processing of OSGI DS component annotations -->
                            <_dsannotations>*</_dsannotations>
                            <!-- Enable processing of OSGI metatype annotations -->
                            <_metatypeannotations>*</_metatypeannotations>
                        </instructions>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.googlecode.maven-download-plugin</groupId>
                    <artifactId>download-maven-plugin</artifactId>
                    <version>1.3.0</version>
                    <executions>
                        <execution>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>wget</goal>
                            </goals>
                            <configuration>
                                <url>https://raw.githubusercontent.com/vaadin/flow/master/drivers.xml</url>
                                <outputFileName>drivers.xml</outputFileName>
                                <outputDirectory>${project.build.directory}</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>${jetty.version}</version>
                    <configuration>
                        <httpConnector>
                            <port>9998</port>
                        </httpConnector>
                        <scanIntervalSeconds>-1</scanIntervalSeconds>
                        <stopPort>9999</stopPort>
                        <stopWait>5</stopWait>
                        <stopKey>foo</stopKey>
                        <webAppConfig>
                            <containerIncludeJarPattern>^$</containerIncludeJarPattern>
                            <webInfIncludeJarPattern>^((?!flow-server-production-mode).)*$</webInfIncludeJarPattern>
                        </webAppConfig>
                        <systemProperties>
                            <!-- Needed when running IT from parent folder -->
                            <systemProperty>
                                <name>project.basedir</name>
                                <value>${project.basedir}</value>
                            </systemProperty>
                        </systemProperties>
                    </configuration>
                    <executions>
                        <!-- start and stop jetty (running our app) when
                            running integration tests -->
                        <execution>
                            <id>start-jetty</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>deploy-war</goal>
                            </goals>
                            <configuration>
                                <daemon>true</daemon>
                                <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-failsafe-plugin</artifactId>
                    <version>${maven.failsafe.plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <systemPropertyVariables>
                            <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven.resources.plugin.version}</version>
                    <executions>
                        <execution>
                            <id>copy-resources-for-demo-website</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                <overwrite>true</overwrite>
                                <resources>
                                    <resource>
                                        <directory>src/test/java</directory>
                                    </resource>
                                    <resource>
                                        <directory>src/main/webapp</directory>
                                        <targetPath>META-INF/resources</targetPath>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <id>extract-component-name</id>
                            <goals>
                                <goal>regex-property</goal>
                            </goals>
                            <configuration>
                                <name>component.name</name>
                                <regex>vaadin-(\w+(-\w+)*)-flow</regex>
                                <value>${project.artifactId}</value>
                                <replacement>$1</replacement>
                                <failIfNoMatch>false</failIfNoMatch>
                            </configuration>
                        </execution>
                        <execution>
                            <id>extract-component-package-name</id>
                            <goals>
                                <goal>regex-property</goal>
                            </goals>
                            <configuration>
                                <name>component.package.name</name>
                                <regex>-</regex>
                                <value>${component.name}</value>
                                <replacement></replacement>
                                <failIfNoMatch>false</failIfNoMatch>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>com.lazerycode.selenium</groupId>
                    <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                    <version>${driver.binary.downloader.maven.plugin.version}</version>
                    <configuration>
                        <onlyGetDriversForHostOperatingSystem>true</onlyGetDriversForHostOperatingSystem>
                        <rootStandaloneServerDirectory>${project.build.directory}/driver</rootStandaloneServerDirectory>
                        <downloadedZipFileDirectory>${project.build.directory}/driver_zips</downloadedZipFileDirectory>
                        <customRepositoryMap>${project.build.directory}/drivers.xml</customRepositoryMap>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>selenium</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.googlecode.maven-download-plugin</groupId>
                                        <artifactId>download-maven-plugin</artifactId>
                                        <versionRange>[1.3.0,)</versionRange>
                                        <goals>
                                            <goal>wget</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute>
                                            <runOnIncremental>false</runOnIncremental>
                                        </execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-maven-plugin</artifactId>
                    <version>${flow.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-frontend</goal>
                                <goal>build-frontend</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>${project.basedir}</directory>
                                <includes>
                                    <include>package*.json</include>
                                    <include>webpack.config.js</include>
                                </includes>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencyManagement>
        <dependencies>
            <!-- Flow -->
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow</artifactId>
                <version>${flow.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-server</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-client</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-data</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-html-components</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-lumo-theme</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-server-production-mode</artifactId>
                <version>${flow.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-osgi</artifactId>
                <version>${flow.version}</version>
            </dependency>

            <!-- Demo Helpers -->
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-component-demo-helpers</artifactId>
                <version>${flow.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.7.25</version>
            </dependency>

            <!-- Extras for components -->
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.cmpn</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <scope>provided</scope>
                <version>6.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.0</version>
            </dependency>

            <!-- Test scoped for the component module -->
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-test-generic</artifactId>
                <version>${flow.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-test-util</artifactId>
                <version>${flow.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>1.10.19</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>1.3</version>
                <scope>test</scope>
            </dependency>
            <!-- Test scoped for the integration tests module -->
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-testbench-core</artifactId>
                <version>${testbench.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- there should be a way to remove this when in npm-mode -->
        <dependency>
            <groupId>org.webjars.bowergithub.polymer</groupId>
            <artifactId>polymer</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.webjars.bowergithub.webcomponents</groupId>
            <artifactId>webcomponentsjs</artifactId>
            <version>1.2.6</version>
        </dependency>
        <dependency>
            <groupId>org.webjars.bowergithub.webcomponents</groupId>
            <artifactId>shadycss</artifactId>
            <version>1.5.0-1</version>
        </dependency>
        <dependency>
            <groupId>org.webjars.bowergithub.vaadin</groupId>
            <artifactId>vaadin-element-mixin</artifactId>
            <!--  IMPORTANT NOTE: if you update this version check that
               transitive dependencies (mvn dependency:tree) versions are
               also the most recent ones: see below. At the moment these are
               two deps "vaadin-usage-statistics" and
               "vaadin-development-mode-detector"  -->
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.webjars.bowergithub.vaadin</groupId>
            <artifactId>vaadin-usage-statistics</artifactId>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.webjars.bowergithub.vaadin</groupId>
            <artifactId>vaadin-development-mode-detector</artifactId>
            <version>2.0.4</version>
        </dependency>
    </dependencies>
</project>
