<?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-platform-parent</artifactId>
        <version>25.2-SNAPSHOT</version>
    </parent>

    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-ee</artifactId>
    <packaging>jar</packaging>
    <name>Vaadin Enterprise Edition</name>
    <description>Vaadin Enterprise Edition</description>
    <url>https://vaadin.com</url>

    <distributionManagement>
        <repository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases/</url>
        </repository>
    </distributionManagement>

    <properties>
                <flow.components.version>25.2-SNAPSHOT</flow.components.version>
        <vaadin.license.checker.version>3.1-SNAPSHOT</vaadin.license.checker.version>

    </properties>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core-internal</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-internal</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spreadsheet-flow</artifactId>
            <version>${flow.components.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>license-checker</artifactId>
            <version>${vaadin.license.checker.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Mark the jar as a commercial product so the production build
                 (flow build-frontend) requires a vaadin-ee license and fails
                 when none is present. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <CvdlName>vaadin-ee</CvdlName>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.reformanda.semper</groupId>
                <artifactId>dependencyversion-maven-plugin</artifactId>
                <version>1.0.1</version>
                <executions>
                    <execution>
                        <id>set-all</id>
                        <goals>
                            <goal>set-version</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>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <!-- Override the inherited configuration completely so this
                     umbrella does not aggregate dependency sources, which would
                     try to invoke javadoc on the internal modules and fail. -->
                <configuration combine.self="override">
                    <doclint>none</doclint>
                    <quiet>true</quiet>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>enforce-maven-version</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <!-- maven >= 3.2.5 -->
                                    <version>[3.2.5,)</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <dependencyConvergence>
                                    <excludes>
                                        <!-- exclude flow-*, as sometimes, the dependencies are using flow snapshot instead of released version  -->
                                        <exclude>com.vaadin:flow-*</exclude>
                                        <!-- we will not align the slf4j version in platform, as the MPR support and license-checker -->
                                        <exclude>org.slf4j:slf4j-api</exclude>
                                        <!-- commons-lang3 in grid comes with a newer version until other commons from flow have the same -->
                                        <exclude>org.apache.commons:commons-lang3</exclude>
                                    </excludes>
                                </dependencyConvergence>
                                <requireUpperBoundDeps>
                                    <excludes>
                                        <exclude>com.vaadin:flow-server</exclude>
                                        <exclude>com.vaadin:flow-html-components</exclude>
                                        <exclude>com.vaadin:flow-data</exclude>
                                        <exclude>org.slf4j:slf4j-api</exclude>
                                        <exclude>com.vaadin:license-checker</exclude>
                                    </excludes>
                                </requireUpperBoundDeps>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/generated-sources</outputDirectory>
                            <delimiters>
                                <delimeter>${*}</delimeter>
                            </delimiters>
                            <useBuildFilters>false</useBuildFilters>
                            <useDefaultDelimiters>false</useDefaultDelimiters>
                            <resources>
                                <resource>
                                    <directory>src/main/templates</directory>
                                    <filtering>true</filtering>
                                </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>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/target/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- enforce no snapshot version in the release
                 only enabled during release configuration-->
            <id>no-snapshot</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>3.5.0</version>
                        <executions>
                            <execution>
                                <id>enforce-no-snapshots</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireReleaseDeps>
                                            <message>No Snapshots Allowed!</message>
                                        </requireReleaseDeps>
                                    </rules>
                                    <fail>true</fail>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
