<?xml version="1.0"?>
<!--
~ Copyright 2024 the original author or authors.
~
~ 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.rest-assured</groupId>
        <artifactId>modules</artifactId>
        <version>5.5.0</version>
    </parent>
    <artifactId>scala-extensions</artifactId>
    <version>5.5.0</version>
    <name>scala-extensions</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <scala-maven-plugin.version>4.9.2</scala-maven-plugin.version>
        <scala.version>3.4.2</scala.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala3-library_3</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>5.5.0</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>${scala-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <?m2e ignore?>
                                <id>scala-compile-first</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <?m2e ignore?>
                                <id>scala-test-compile</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                    <goal>testCompile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>doc-jar</goal>
                                </goals>
                                <!-- Workaround for bug in scala-maven-plugin, see https://github.com/davidB/scala-maven-plugin/issues/604 -->
                                <configuration>
                                    <scaladocClassName>dotty.tools.scaladoc.Main</scaladocClassName>
                                    <sourceDir>${project.build.outputDirectory}</sourceDir>
                                    <args>-nobootcp</args>
                                    <includes>
                                        <include>**/*.tasty</include>
                                    </includes>
                                    <dependencies>
                                        <dependency>
                                            <groupId>org.scala-lang</groupId>
                                            <artifactId>scaladoc_3</artifactId>
                                            <version>${scala.version}</version>
                                        </dependency>
                                    </dependencies>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <scalaVersion>${scala.version}</scalaVersion>
                            <args>
                                <arg>-feature</arg>
                                <arg>-deprecation</arg>
                                <arg>-Ysemanticdb</arg>
                            </args>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <?m2e ignore?>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <?m2e ignore?>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <args>
                        <arg>-feature</arg>
                        <arg>-deprecation</arg>
                        <arg>-Ysemanticdb</arg>
                    </args>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
