<?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>

	<artifactId>ui-identity</artifactId>
	<packaging>jar</packaging>
	<name>VITAMUI UI Identity</name>

	<parent>
		<groupId>fr.gouv.vitamui</groupId>
		<artifactId>ui-parent</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>

	<properties>
		<angular.base.href>/identity/</angular.base.href>
        <angular.build.project>identity</angular.build.project>
		<rpm.skip>false</rpm.skip>
		<sonar.sources>src/main/java</sonar.sources>
        <skipAllFrontend>false</skipAllFrontend>
		<skipAllFrontendTests>false</skipAllFrontendTests>
        <swagger.dir>ui</swagger.dir>
        <swagger.skip>false</swagger.skip>
    </properties>

	<dependencies>

		<!--VITAMUI -->
		<dependency>
			<groupId>fr.gouv.vitamui.ui</groupId>
			<artifactId>ui-commons</artifactId>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitamui.commons</groupId>
			<artifactId>commons-api</artifactId>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitamui</groupId>
			<artifactId>iam-commons</artifactId>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitamui.commons</groupId>
			<artifactId>commons-rest</artifactId>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitamui</groupId>
			<artifactId>iam-external-client</artifactId>
		</dependency>
		<dependency>
			<groupId>fr.gouv.vitamui.commons</groupId>
			<artifactId>commons-security</artifactId>
		</dependency>
        <dependency>
            <groupId>fr.gouv.vitamui</groupId>
            <artifactId>ui-frontend</artifactId>
            <scope>provided</scope>
            <type>pom</type>
            <version>${project.version}</version>
        </dependency>

		<!-- SPRING BOOT -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-consul-discovery</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Documentation -->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger2</artifactId>
		</dependency>
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger-ui</artifactId>
		</dependency>

		<!-- UTILS -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
        </dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>javax.ws.rs-api</artifactId>
		</dependency>

		<!--TEST -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
		    <groupId>org.springframework.security</groupId>
		    <artifactId>spring-security-test</artifactId>
		    <scope>test</scope>
		</dependency>

		<dependency>
			<groupId>fr.gouv.vitamui.commons</groupId>
			<artifactId>commons-test</artifactId>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>fr.gouv.vitamui.ui</groupId>
			<artifactId>ui-commons</artifactId>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>target/www/</directory>
				<targetPath>static/</targetPath>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
				<filtering>true</filtering>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
			            <id>build-info</id>
			            <goals>
			                <goal>build-info</goal>
			            </goals>
			        </execution>
					<execution>
						<id>spring-boot-repackage</id>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<executable>true</executable>
					<attach>false</attach> <!-- Need to use the original jar for integration-tests -->
					<mainClass>fr.gouv.vitamui.identity.IdentityApplication</mainClass>
                   	<jvmArguments>-Xmx512m</jvmArguments>
					<arguments>
						<!-- use src/main/config/application-dev.yml when using mvn spring-boot:run -->
						<!-- See : https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files -->
						<argument>--spring.config.additional-location=file:${basedir}/src/main/config/ui-identity-application-dev.yml</argument>
					</arguments>
				</configuration>
			</plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
            </plugin>
		</plugins>
	</build>

    <profiles>
        <profile>
            <id>rpm</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>rpm-package-admin</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>make</executable>
                                    <workingDirectory>target</workingDirectory>
                                    <skip>${rpm.skip}</skip>
                                    <arguments>
                                        <argument>-f</argument>
                                        <argument>${maven.multiModuleProjectDirectory}/tools/packaging/Makefile</argument>
                                        <argument>rpm</argument>
                                        <argument>NAME=${project.artifactId}-admin</argument>
                                        <argument>VERSION=${project.version}</argument>
                                        <argument>JAR_FILE=${rpm.jar-file}</argument>
                                        <argument>USER=vitamui</argument>
                                        <!--
                                           If you want to changes default dependencies (only systemd), define them as a
                                            comma separated list of packages
                                        -->
                                        <argument>DEPENDENCIES=systemd,java-11-openjdk</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>