<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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">
    <parent>
        <artifactId>keycloak-integration-parent</artifactId>
        <groupId>org.keycloak</groupId>
        <version>24.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>keycloak-admin-client</artifactId>
    <name>Keycloak Admin REST Client</name>
    <description/>

    <properties>
        <ant.jvm.args>-Dnone</ant.jvm.args>

        <jakarta-transformer-sources>${project.basedir}/../admin-client-jee/src</jakarta-transformer-sources>
        <jakarta-transformer-target>${project.basedir}/src</jakarta-transformer-target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-common</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>transform</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <property name="plugin_classpath" refid="maven.plugin.classpath"/>
                                <java classname="org.eclipse.transformer.jakarta.JakartaTransformer" fork="true">
                                    <jvmarg value="${ant.jvm.args}"/>
                                    <arg value="-o"/>
                                    <arg value="${jakarta-transformer-sources}"/>
                                    <arg value="${jakarta-transformer-target}"/>
                                    <classpath>
                                        <pathelement path="${plugin_classpath}"/>
                                    </classpath>
                                </java>
                                <!-- Possibility to override classes for admin-client-jee -->
                                <!-- Remove this comment in that case
                                <touch>
                                    <fileset dir="${jakarta-transformer-target}"/>
                                </touch>
                                <copy todir="${jakarta-transformer-target}" overwrite="false">
                                    <fileset dir="${jakarta-transformer-target}/tmp"/>
                                </copy>
                                <delete dir="${jakarta-transformer-target}/tmp"/>
                                -->
                            </target>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.eclipse.transformer</groupId>
                        <artifactId>org.eclipse.transformer.cli</artifactId>
                        <version>0.2.0</version>
                    </dependency>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>1.0b3</version>
                        <exclusions>
                            <exclusion>
                                <groupId>ant</groupId>
                                <artifactId>ant</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk17+</id>
            <activation>
                <jdk>[17,)</jdk>
            </activation>
            <properties>
                <!--For more information, see https://github.com/apache/ant/pull/200-->
                <ant.jvm.args>-Djava.security.manager=allow</ant.jvm.args>
            </properties>
        </profile>
    </profiles>

</project>
