<?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>in.virit.sb</groupId>
        <artifactId>project-parent</artifactId>
        <version>0.0.7</version>
        <relativePath>../project-parent</relativePath>
    </parent>
    <groupId>in.virit.sb</groupId>
    <artifactId>viritin-project-parent</artifactId>
    <name>viritin-project-parent</name>
    <description>A parent pom for a slim Vaadin project using Viritin</description>
    <packaging>pom</packaging>
    <version>0.0.7</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
    <organization>
        <name>Viritin</name>
    </organization>
    <url>https://github.com/viritin/viritin-sb</url>
    <developers>
        <developer>
            <name>Matti Tahvonen</name>
        </developer>
    </developers>
    <scm>
        <url>https://github.com/viritin/viritin-sb</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>viritin-project-parent-0.0.7</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>
    
    <build>
        <plugins>
            <!-- Configure front-end build to get rid of React & React Router for smaller bundle size -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-maven-plugin</artifactId>
                <version>${flow.version}</version>
                <configuration>
                    <reactEnable>false</reactEnable>
                    <forceProductionBuild>true</forceProductionBuild>
                </configuration>
            </plugin>            
        </plugins>
    </build>


    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>${vaadin.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-dev</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>hilla</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-react</artifactId>
                </exclusion>
                <!-- Viritin upload is superior, just remove the defaul that you shouldn't touch. -->
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-upload</artifactId>
                </exclusion>
                <!-- TODO check if could get rid of these with custom servlet impl
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-fileupload2-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-fileupload2-jakarta</artifactId>
                </exclusion>
                -->
            </exclusions>
        </dependency>
        
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-dev</artifactId>
            <scope>test</scope>
            <version>${vaadin.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>hilla-dev</artifactId>
                </exclusion>
                <!-- This just makes things much faster to debug this kind of setup. Too bad we lose all developmen mode widgets. Add back later if it starts to behave well -->
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>copilot</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>in.virit</groupId>
            <artifactId>viritin</artifactId>
            <version>2.8.24</version>
        </dependency>
        
    </dependencies>

    <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>true</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>