<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>
    <parent>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-platform-parent</artifactId>
        <version>25.0-SNAPSHOT</version>
    </parent>
    <artifactId>vaadin-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>Vaadin Maven plugin</name>

    <prerequisites>
        <maven>3.0</maven>
    </prerequisites>

    <properties>
        <flow.version>25.0-SNAPSHOT</flow.version>
        <hilla.version>25.0-SNAPSHOT</hilla.version>

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

    <dependencies>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.9.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-server</artifactId>
            <version>${flow.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>hilla-maven-plugin</artifactId>
            <version>${hilla.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-prod-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- Dev bundle is needed to copy package-lock file from it to the project, -->
        <!-- this speeds up the production bundle build -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-dev-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <!-- Needed for lambdas in Mojos -->
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>3.15.2</version>
                    <configuration>
                        <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                        <requiredJavaVersion>21</requiredJavaVersion>
                        <requiredMavenVersion>3.8</requiredMavenVersion>
                    </configuration>
                    <executions>
                        <execution>
                            <id>mojo-descriptor</id>
                            <goals>
                                <goal>descriptor</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Remove the generated files into /src/main/**, when clean the project
                 Fixes https://github.com/vaadin/platform/issues/777 -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${project.basedir}/src/main</directory>
                            <includes>
                                <include>**</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>hilla-maven-plugin</artifactId>
                                    <version>${hilla.version}</version>
                                    <classifier>sources</classifier>
                                    <includes>**/*.java</includes>
                                    <outputDirectory>src/main/java</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>hilla-maven-plugin</artifactId>
                                    <version>${hilla.version}</version>
                                    <excludes>**/*.class,META-INF/**</excludes>
                                    <outputDirectory>src/main/resources</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>hilla-maven-plugin</artifactId>
                                    <version>${hilla.version}</version>
                                    <includes>**/lifecycle-mapping-metadata.xml</includes>
                                    <outputDirectory>src/main/resources</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.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.11.2</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includeDependencySources>false</includeDependencySources>Add commentMore actions
                    <includeTransitiveDependencySources>false</includeTransitiveDependencySources>
                    <quiet>true</quiet>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
            </plugin>
        </plugins>

    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.15.2</version>
            </plugin>
        </plugins>
    </reporting>
</project>
