<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>capital.scalable</groupId>
        <artifactId>spring-auto-restdocs-parent</artifactId>
        <version>2.0.11</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>spring-auto-restdocs-json-doclet-jdk9</artifactId>
    <packaging>jar</packaging>

    <name>Spring Auto REST Docs Json Doclet for JDK9+</name>
    <description>Doclet exporting JavaDoc to JSON for Spring Auto REST Docs</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <!--
             | Jackson Databind 2.12.0 has a breaking API change that is corrected in 2.12.1
             | If you are using Java 14 records, you must use version 2.12.1 or later.
             | Otherwise, you can use any version other than 2.12.0.
             | 
             | NOTE:
             | This version range may be removed once the parent project specifies a range
             | greater than 2.12.0.
             +-->
            <version>[2.11.2,2.12.0),[2.12.1,2.99)</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.skyscreamer</groupId>
            <artifactId>jsonassert</artifactId>
            <version>1.5.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>9</release>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>

        <profile>
            <id>java14</id>
            <activation>
                <jdk>[14,17)</jdk>
            </activation>
            <build>

                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <configuration>
                                <argLine>
                                    --enable-preview
                                    --illegal-access=permit
                                </argLine>
                                <!-- Force alphabetical order to have a reproducible build -->
                                <runOrder>alphabetical</runOrder>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test-compile-java-14</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>
                                    <release>${java.specification.version}</release>
                                    <multiReleaseOutput>true</multiReleaseOutput>
                                    <compilerArgs>
                                      <!-- Enables use of record and text blocks -->
                                      <compilerArg>--enable-preview</compilerArg>
                                    </compilerArgs>
                                    <compileSourceRoots>
                                        <compileSourceRoot>${project.basedir}/src/test/java14</compileSourceRoot>
                                    </compileSourceRoots>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
