<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ ******************************************************************************
  ~ Copyright (c) 2022 Konduit K.K.
  ~
  ~ This program and the accompanying materials are made available under the
  ~ terms of the Apache License, Version 2.0 which is available at
  ~ https://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.
  ~
  ~ SPDX-License-Identifier: Apache-2.0
  ~ *****************************************************************************
  -->

<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>konduit-serving</artifactId>
        <groupId>ai.konduit.serving</groupId>
        <version>0.0.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>konduit-serving-clients</artifactId>

    <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-jaxrs2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
        </dependency>
        <dependency>
            <groupId>ai.konduit.serving</groupId>
            <artifactId>konduit-serving-meta</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen</artifactId>
            <version>3.0.20</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen-generators</artifactId>
            <version>1.0.20</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>generate-resources</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>
                        target/classes/META-INF/${project.artifactId}-git.properties
                    </generateGitPropertiesFilename>
                    <gitDescribe>
                        <skip>true</skip>
                    </gitDescribe>
                </configuration>
            </plugin>
            <!--
                The plugin below is used for creating a maven property "konduit.test.class.path"
                that will contain the classpath value. This was needed because the tests run sometimes have different
                value for the system property "java.class.path" than the actual classpath.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <id>build-classpath</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>build-classpath</goal>
                        </goals>
                        <configuration>
                            <outputProperty>konduit.generator.class.path</outputProperty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip> <!--Unskip when it's solved for conflicting setters-->
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <argument>${konduit.generator.class.path}${path.separator}${project.build.directory}/${project.build.finalName}.jar</argument>
                                <argument>-Dkonduit.generator.clients.directory=${project.basedir}/../clients</argument>
                                <argument>ai.konduit.serving.clients.generators.GenerateRestClients</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>