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

    JBoss, Home of Professional Open Source.
    Copyright 2014-2022 Red Hat, Inc., and individual 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>parent</artifactId>
        <groupId>org.jboss.pnc</groupId>
        <version>3.2.9</version>
    </parent>

    <artifactId>rest-api</artifactId>
    <packaging>jar</packaging>

    <name>PNC :: REST API</name>
    <description>Module with REST API bidings.</description>


    <dependencies>
        <!-- Project dependencies -->
        <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>pnc-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>dto</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>dto</artifactId>
            <classifier>patch-builders</classifier>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>test-common</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- java client dependencies -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- REST dependencies -->
        <dependency>
            <groupId>org.jboss.pnc.metrics</groupId>
            <artifactId>pncmetrics</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>

        <!-- Build dependencies -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>processor</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock-jre8</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.openapitools.swagger</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>2.1.5</version>
                <configuration>
                    <resourcePackages>
                        <resourcePackage>org.jboss.pnc.rest.api.endpoints</resourcePackage>
                        <resourcePackage>org.jboss.pnc.rest.configuration</resourcePackage>
                    </resourcePackages>
                    <outputDirectory>${basedir}</outputDirectory>
                    <outputFilename>pnc-openapi</outputFilename>
                    <outputFormats>JSON,YAML</outputFormats>
                    <prettyPrint>true</prettyPrint>
                    <attachSwaggerArtifact>true</attachSwaggerArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.4.2</version>
                <executions>
                    <execution>
                        <id>with-client</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <classifier>java-client</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>org/jboss/pnc/client/**/*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <!-- Name integration test classes properly (*IT.java, IT*.java)-->
              <!-- <includes>-->
              <!--   <include>**/*.java</include>-->
              <!-- </includes>-->
              <groups>org.jboss.pnc.test.category.ContainerTest</groups>
              <excludedGroups>org.jboss.pnc.test.category.DebugTest</excludedGroups>
              <!-- use classes directory, the default jar does not include all the classes -->
              <classesDirectory>${project.build.outputDirectory}</classesDirectory>
            </configuration>
          </plugin>
          <plugin>
              <groupId>org.eclipse.transformer</groupId>
              <artifactId>transformer-maven-plugin</artifactId>
              <version>0.5.0</version>
              <extensions>true</extensions>
              <configuration>
                  <rules>
                      <jakartaDefaults>true</jakartaDefaults>
                  </rules>
              </configuration>
              <executions>
                  <execution>
                      <id>with-client</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <artifact>
                              <groupId>${project.groupId}</groupId>
                              <artifactId>${project.artifactId}</artifactId>
                              <version>${project.version}</version>
                              <classifier>java-client</classifier>
                          </artifact>
                          <classifier>java-client-jakarta</classifier>
                      </configuration>
                  </execution>
                  <execution>
                      <id>default-jar</id>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                      <configuration>
                          <classifier>jakarta</classifier>
                          <artifact>
                              <groupId>${project.groupId}</groupId>
                              <artifactId>${project.artifactId}</artifactId>
                              <version>${project.version}</version>
                          </artifact>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
      </plugins>
    </build>
  
</project>
