<?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.keycloak</groupId>
        <artifactId>keycloak-client-parent</artifactId>
        <version>26.0.8</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>keycloak-authz-client</artifactId>
    <packaging>jar</packaging>

    <name>Keycloak Authz: Client API</name>
    <description>KeyCloak AuthZ: Client API</description>

    <dependencies>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-client-common-synced</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>commons-logging-jboss-logging</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.microprofile.openapi</groupId>
            <artifactId>microprofile-openapi-api</artifactId>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>sync</id>
            <build>
                <resources>
                    <resource>
                        <directory>${project.build.directory}/unpacked-resources</directory>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-keycloak-sources</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.keycloak</groupId>
                                            <artifactId>keycloak-authz-client-tests</artifactId>
                                            <version>${keycloak.version}</version>
                                            <type>jar</type>
                                            <classifier>sources</classifier>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
                                            <includes>
                                                org/**/*,
                                            </includes>  <!-- unpack just source code and potential services -->
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.keycloak</groupId>
                                            <artifactId>keycloak-authz-client-tests</artifactId>
                                            <version>${keycloak.version}</version>
                                            <type>jar</type>
                                            <classifier>sources</classifier>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}/unpacked-resources</outputDirectory>
                                            <includes>
                                                META-INF/services/**/*
                                            </includes>
                                        </artifactItem>
                                    </artifactItems>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>true</overWriteSnapshots>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/unpacked</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
