<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.gravitee.am.management</groupId>
        <artifactId>gravitee-am-management-api</artifactId>
        <version>4.8.40</version>
    </parent>

    <artifactId>gravitee-am-management-api-rest</artifactId>
    <name>Gravitee IO - Access Management - Management API - Rest</name>

    <dependencies>
        <dependency>
            <groupId>io.gravitee.am.management</groupId>
            <artifactId>gravitee-am-management-api-service</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
        </dependency>

        <!-- Gravitee dependencies -->
        <dependency>
            <groupId>io.gravitee.plugin</groupId>
            <artifactId>gravitee-plugin-repository</artifactId>
        </dependency>
        <dependency>
            <groupId>io.gravitee.am.plugins.handlers</groupId>
            <artifactId>gravitee-am-plugins-handlers-identityprovider</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gravitee.am.plugins.handlers</groupId>
            <artifactId>gravitee-am-plugins-handlers-dataplane</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Spring dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>${jakarta.servlet-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Thymeleaf -->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring6</artifactId>
        </dependency>
        <dependency>
            <groupId>ognl</groupId>
            <artifactId>ognl</artifactId>
            <version>${ognl.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>

        <!-- Jersey dependencies -->
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.ext</groupId>
            <artifactId>jersey-bean-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.ext</groupId>
            <artifactId>jersey-spring6</artifactId>
        </dependency>

        <!-- JAXB dependencies -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>

        <!-- Swagger -->
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-jaxrs2-jakarta</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
            <artifactId>jersey-test-framework-provider-jetty</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.am.dataplane</groupId>
            <artifactId>gravitee-am-dataplane-junit</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <!--
            generate-oas: Regenerates docs/mapi/openapi.yaml at build time using
            classpath scanning (no running server required).

            Usage (from repo root):
              mvn -pl gravitee-am-management-api/gravitee-am-management-api-rest \
                  process-classes -Pgenerate-oas -DskipTests - -also-make

            Or use the convenience script which also patches info.version:
              bash scripts/regen-oas.sh
        -->
        <profile>
            <id>generate-oas</id>
            <properties>
                <!-- Override on the command line to redirect output, e.g. -Doas.outputPath=/tmp/oas-gen -->
                <oas.outputPath>${project.basedir}/../../docs/mapi</oas.outputPath>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.swagger.core.v3</groupId>
                        <artifactId>swagger-maven-plugin-jakarta</artifactId>
                        <version>${swagger.version}</version>
                        <configuration>
                            <outputFileName>openapi</outputFileName>
                            <outputPath>${oas.outputPath}</outputPath>
                            <outputFormat>YAML</outputFormat>
                            <resourcePackages>
                                <resourcePackage>io.gravitee.am.management.handlers.management.api.resources</resourcePackage>
                            </resourcePackages>
                            <prettyPrint>TRUE</prettyPrint>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>resolve</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
