<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2010-2022 Evolveum and contributors
  ~
  ~ Licensed under the EUPL-1.2 or later.
  -->

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>gui</artifactId>
        <groupId>com.evolveum.midpoint.gui</groupId>
        <version>4.10-RC2</version>
    </parent>

    <artifactId>midpoint-jar</artifactId>
    <name>midPoint Spring Boot JAR</name>

    <properties>
        <maven.test.skip>true</maven.test.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.evolveum.midpoint.gui</groupId>
            <artifactId>admin-gui</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
        </dependency>
    	<dependency>
          <groupId>net.bytebuddy</groupId>
          <artifactId>byte-buddy</artifactId>
          <scope>runtime</scope>
   	</dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>jar-signing</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jarsigner-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>sign</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <keystore>${env.MIDPOINT_BUILD_KEYSTORE}</keystore>
                            <alias>${env.MIDPOINT_BUILD_ALIAS}</alias>
                            <storepass>${env.MIDPOINT_BUILD_STOREPASS}</storepass>
                            <keypass>${env.MIDPOINT_BUILD_KEYPASS}</keypass>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dependencytrack</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.github.pmckeown</groupId>
                        <artifactId>dependency-track-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>upload-bom</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>upload-bom</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <finalName>midpoint</finalName>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>banner.txt</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <verbose>false</verbose>
                    <offline>true</offline>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.evolveum.midpoint.web.boot.MidPointSpringApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                        <configuration>
                            <layoutFactory implementation="com.evolveum.midpoint.launcher.MidPointJarLayoutFactory"/>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.evolveum.midpoint.tools</groupId>
                        <artifactId>midpoint-boot-layout</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
                <configuration>
                    <projectType>application</projectType>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
