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

	<parent>
		<groupId>io.kokuwa.maven</groupId>
		<artifactId>maven-parent</artifactId>
		<version>0.6.18</version>
		<relativePath />
	</parent>

	<groupId>io.kokuwa.keycloak</groupId>
	<artifactId>keycloak-event-metrics</artifactId>
	<version>1.1.1</version>

	<name>Keycloak Metrics</name>
	<description>Provides metrics for Keycloak user/admin events</description>
	<url>https://github.com/kokuwaio/keycloak-event-metrics</url>
	<inceptionYear>2023</inceptionYear>
	<organization>
		<name>Kokuwa.io</name>
		<url>http://kokuwa.io</url>
	</organization>
	<licenses>
		<license>
			<name>Apache-2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<id>sschnabe</id>
			<name>Stephan Schnabel</name>
			<url>https://github.com/sschnabe</url>
			<email>stephan@grayc.de</email>
			<organization>GrayC GmbH</organization>
			<organizationUrl>https://grayc.de</organizationUrl>
			<timezone>Europe/Berlin</timezone>
		</developer>
	</developers>

	<scm>
		<url>https://github.com/kokuwaio/keycloak-event-metrics</url>
		<connection>scm:git:https://github.com/kokuwaio/keycloak-event-metrics.git</connection>
		<developerConnection>scm:git:https://github.com/kokuwaio/keycloak-event-metrics.git</developerConnection>
		<tag>1.1.1</tag>
	</scm>
	<issueManagement>
		<system>github</system>
		<url>https://github.com/kokuwaio/keycloak-event-metrics/issues</url>
	</issueManagement>
	<ciManagement>
		<system>github</system>
		<url>https://github.com/kokuwaio/keycloak-event-metrics/actions</url>
	</ciManagement>

	<properties>

		<!-- ===================================================================== -->
		<!-- =============================== Build =============================== -->
		<!-- ===================================================================== -->

		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>

		<maven.release.releaseProfiles>deploy,site,ossrh,release</maven.release.releaseProfiles>

		<!-- ===================================================================== -->
		<!-- ============================== Libaries ============================= -->
		<!-- ===================================================================== -->

		<version.org.keycloak>26.2.1</version.org.keycloak>
		<version.org.keycloak.test>${version.org.keycloak}</version.org.keycloak.test>
		<version.org.testcontainers>1.18.3</version.org.testcontainers>

	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.keycloak</groupId>
				<artifactId>keycloak-quarkus-server</artifactId>
				<version>${version.org.keycloak}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<dependencies>

		<!-- keycloak -->
		<dependency>
			<groupId>org.keycloak</groupId>
			<artifactId>keycloak-core</artifactId>
			<version>${version.org.keycloak.test}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.keycloak</groupId>
			<artifactId>keycloak-server-spi</artifactId>
			<version>${version.org.keycloak.test}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.keycloak</groupId>
			<artifactId>keycloak-server-spi-private</artifactId>
			<version>${version.org.keycloak.test}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.keycloak</groupId>
			<artifactId>keycloak-admin-client</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.glassfish.jaxb</groupId>
					<artifactId>jaxb-runtime</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.jboss.resteasy</groupId>
					<artifactId>resteasy-multipart-provider</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- libraries -->
		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>jboss-logging</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>commons-logging-jboss-logging</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hibernate.orm</groupId>
			<artifactId>hibernate-core</artifactId>
			<scope>provided</scope>
			<exclusions>
				<exclusion>
					<groupId>javax.xml.bind</groupId>
					<artifactId>jaxb-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.glassfish.jaxb</groupId>
					<artifactId>jaxb-runtime</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.hibernate.common</groupId>
					<artifactId>hibernate-commons-annotations</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.jboss</groupId>
					<artifactId>jandex</artifactId>
				</exclusion>
				<exclusion>
					<groupId>antlr</groupId>
					<artifactId>antlr</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.fasterxml</groupId>
					<artifactId>classmate</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>io.micrometer</groupId>
			<artifactId>micrometer-core</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- test -->
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>testcontainers</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<testResources>
			<testResource>
				<directory>${project.basedir}/src/test/resources</directory>
				<filtering>true</filtering>
			</testResource>
		</testResources>
		<plugins>

			<!-- run tests -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
							<goal>verify</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- flatten fails because of groupId ${ee.maven.groupId} - skip -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>default</id>
						<phase />
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

	<profiles>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<phase>prepare-package</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<resources>
										<resource>
											<directory>${project.basedir}/src/main/docker</directory>
											<filtering>true</filtering>
										</resource>
									</resources>
									<outputDirectory>${project.build.directory}</outputDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<phase>deploy</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>docker</executable>
									<arguments>
										<argument>build</argument>
										<argument>${project.build.directory}</argument>
										<argument>--tag=ghcr.io/kokuwaio/keycloak-event-metrics:latest</argument>
										<argument>--tag=ghcr.io/kokuwaio/keycloak-event-metrics:${project.version}</argument>
										<argument>--tag=docker.io/kokuwaio/keycloak-event-metrics:latest</argument>
										<argument>--tag=docker.io/kokuwaio/keycloak-event-metrics:${project.version}</argument>
										<argument>--push</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>

				</plugins>
			</build>
		</profile>
	</profiles>
</project>
