<?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>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.1</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>in.virit.sb</groupId>
    <artifactId>project-parent</artifactId>
    <name>project-parent</name>
    <description>A parent project (or starter in SB lingo) for Vaadin Flow + Spring Boot apps</description>
    <packaging>pom</packaging>
    <version>0.0.1</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>24.4.4</vaadin.version>
        <flow.version>24.4.2</flow.version>
    </properties>
    
    <organization>
        <name>Viritin</name>
    </organization>
    <url>https://github.com/viritin/flow-viritin</url>
    <developers>
        <developer>
            <name>Matti Tahvonen</name>
        </developer>
    </developers>
    <scm>
        <url>https://github.com/viritin/flow-viritin</url>
        <connection>scm:git:git://github.com/viritin/viritin-sb.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:/viritin/viritin-sb.git</developerConnection>
        <tag>project-parent-0.0.1</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/viritin/viritin-sb/issues</url>
    </issueManagement>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
  
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>${vaadin.version}</version>
            <exclusions>
                <!-- Getting an exception while starting in prod if not excluding this, something too much removed from hilla dev deps, something that is not really just a dev dependency ??-->                        
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>hilla</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>hilla-dev</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- A tooling from here kicks in to enforece dev mod if present. In an ideal situation, this logic would be in vaadin development mode. -->
        <dependency>
            <groupId>in.virit.sb</groupId>
            <artifactId>sb-configs</artifactId>
            <version>0.0.1</version>
        </dependency>
        
    </dependencies>
    
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <configuration>
                            <!-- TODO, try to get these to be submitted to SB plugin dynamically 
                                 from a (custom) front-end plugin. First there was a bug in SB plugin, 
                                 now I can't get them to be fed there anymore from a separate plugin... 
                                 As such this is a PITA to maintain (and can cause valid deps to be excluded).
                            -->
                            <excludes>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>vaadin-dev</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>vaadin-dev-server</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>license-checker</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.github.oshi</groupId>
                                    <artifactId>oshi-core</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>net.java.dev.jna</groupId>
                                    <artifactId>jna</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>net.java.dev.jna</groupId>
                                    <artifactId>jna-platform</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.nimbusds</groupId>
                                    <artifactId>nimbus-jose-jwt</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>org.lucee</groupId>
                                    <artifactId>jcip-annotations</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>open</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.github.javaparser</groupId>
                                    <artifactId>javaparser-core</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.methvin</groupId>
                                    <artifactId>directory-watcher</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>vaadin-dev-bundle</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>hilla-dev</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>copilot</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.projectreactor.netty</groupId>
                                    <artifactId>reactor-netty</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.projectreactor.netty</groupId>
                                    <artifactId>reactor-netty-core</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-handler</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-common</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-resolver</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-buffer</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-transport</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-transport-native-unix-common</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-codec</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-handler-proxy</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-codec-socks</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-resolver-dns</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-codec-dns</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-resolver-dns-native-macos</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-resolver-dns-classes-macos</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-transport-native-epoll</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-transport-classes-epoll</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.projectreactor.netty</groupId>
                                    <artifactId>reactor-netty-http</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-codec-http</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty</groupId>
                                    <artifactId>netty-codec-http2</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.projectreactor.netty.incubator</groupId>
                                    <artifactId>reactor-netty-incubator-quic</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty.incubator</groupId>
                                    <artifactId>netty-incubator-codec-native-quic</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>io.netty.incubator</groupId>
                                    <artifactId>netty-incubator-codec-classes-quic</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>org.apache.commons</groupId>
                                    <artifactId>commons-configuration2</artifactId>
                                </exclude>
                                <exclude>
                                    <groupId>org.apache.commons</groupId>
                                    <artifactId>commons-text</artifactId>
                                </exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-maven-plugin</artifactId>
                <version>${flow.version}</version>
                <!-- Configure front-end build "production bundle" when a deployment artifact is packaged. No special profiles neede. -->
                <executions>
                    <execution>
                        <id>frontend</id>
                        <!-- Not yet on compile, but before actual packaging -->
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>prepare-frontend</goal>
                            <goal>build-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>            
        </plugins>
    </build>
    
    
    <profiles>
        <profile>
            <id>release</id>
            <properties>
                <altReleaseDeploymentRepository>releases::https://oss.sonatype.org/service/local/staging/deploy/maven2/</altReleaseDeploymentRepository>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release</releaseProfiles>
                            <goals>deploy</goals>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>flatten-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <configuration>
                            <flattenMode>oss</flattenMode>
                        </configuration>
                        <executions>
                            <execution>
                                <id>flatten</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>flatten</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>flatten.clean</id>
                                <phase>clean</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.7.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- Prevent gpg from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>