<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 === -->
    <parent>
        <groupId>io.github.chrimle</groupId>
        <artifactId>chrimle-oss-parent</artifactId>
        <version>0.9.0</version>
    </parent>

    <!-- === Project Coordinates === -->
    <artifactId>openapi-to-java-records-mustache-templates-parent</artifactId>
    <version>3.5.1</version>
    <packaging>pom</packaging>

    <!-- === Sub Modules === -->
    <modules>
        <module>mustache-templates</module>
        <module>tests</module>
        <module>test-common</module>
        <module>test-useJakartaEe</module>
        <module>test-utils</module>
    </modules>

    <!-- Project Information -->
    <name>OpenAPI to Java records :: Mustache Templates :: Parent</name>
    <description>Project containing Mustache-templates used by openapi-generator-maven-plugin to generate Java records from OpenAPI Specifications.</description>
    <inceptionYear>2024</inceptionYear>
    <url>https://chrimle.github.io/openapi-to-java-records-mustache-templates/</url>
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <organization>
        <name>openapi-to-java-records-mustache-templates</name>
        <url>https://chrimle.github.io/openapi-to-java-records-mustache-templates/</url>
    </organization>
    <developers>
        <developer>
            <id>Chrimle</id>
            <name>Christopher Molin</name>
            <roles>
                <role>Lead Developer</role>
            </roles>
            <timezone>CET</timezone>
            <url>https://www.chrimle.com</url>
        </developer>
    </developers>
    <!-- -->

    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub Chrimle Apache Maven Packages</name>
            <url>https://maven.pkg.github.com/chrimle/openapi-to-java-records-mustache-templates</url>
        </repository>
        <snapshotRepository>
            <id>github</id>
            <name>GitHub Chrimle Apache Maven Snapshot Packages</name>
            <url>https://maven.pkg.github.com/chrimle/openapi-to-java-records-mustache-templates</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <maven.plugin.validation>VERBOSE</maven.plugin.validation>

        <!-- Dependency Versions -->
        <gson.version>2.13.2</gson.version>
        <jackson-databind-nullable.version>0.2.8</jackson-databind-nullable.version>
        <spotbugs-annotations.version>4.9.8</spotbugs-annotations.version>
        <jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
        <jackson-annotations.version>2.19.0</jackson-annotations.version>
        <!-- Optional Dependencies -->
        <javax.annotation-api.version>1.3.2</javax.annotation-api.version>
        <okio.version>3.12.0</okio.version>
        <okhttp.version>4.12.0</okhttp.version>
        <gson-fire.version>1.9.0</gson-fire.version>
        <spring-web.version>6.2.12</spring-web.version>
        <jackson-datatype-jsr310.version>2.19.0</jackson-datatype-jsr310.version>
        <!-- / Dependency Versions -->

        <!-- Build Plugin Versions -->
        <openapi-generator-maven-plugin.version>7.20.0</openapi-generator-maven-plugin.version>
        <!-- / Build Plugin Versions -->

        <!-- Jacoco -->
        <jacoco-maven-plugin.minimumPackageLineCoveredRatio>1</jacoco-maven-plugin.minimumPackageLineCoveredRatio>
        <jacoco-maven-plugin.expectedBundleClassMissedCount>0</jacoco-maven-plugin.expectedBundleClassMissedCount>
        <!-- Exclusions -->
        <jacoco.excludes>
            **/auth/**,
            **/AbstractOpenApiSchema.class,
            **/ApiCallback.class,
            **/ApiClient.class,
            **/ApiClient$*.class,
            **/ApiException.class,
            **/ApiResponse.class,
            **/Configuration.class,
            **/GzipRequestInterceptor.class,
            **/GzipRequestInterceptor$*.class,
            **/JavaTimeFormatter.class,
            **/JSON.class,
            **/JSON$*.class,
            **/Pair.class,
            **/ProgressRequestBody.class,
            **/ProgressRequestBody$*.class,
            **/ProgressResponseBody.class,
            **/ProgressResponseBody$*.class,
            **/RFC3339DateFormat.class,
            **/RFC3339InstantDeserializer.class,
            **/RFC3339JavaTimeModule.class,
            **/ServerConfiguration.class,
            **/ServerVariable.class,
            **/StringUtil.class
        </jacoco.excludes>
        <!-- /Jacoco -->

        <!-- Spotless -->
        <spotless.check.skip>false</spotless.check.skip> <!-- Unused imports causes build to fail -->
        <!-- /Spotless -->
    </properties>

    <scm>
        <connection>scm:git:git://github.com/chrimle/openapi-to-java-records-mustache-templates.git</connection>
        <developerConnection>scm:git:ssh://github.com:chrimle/openapi-to-java-records-mustache-templates.git</developerConnection>
        <url>http://github.com/chrimle/openapi-to-java-records-mustache-templates/tree/main</url>
    </scm>

    <dependencyManagement>
        <dependencies>
            <!-- Sub-Modules -->
            <dependency>
                <groupId>io.github.chrimle</groupId>
                <artifactId>openapi-to-java-records-mustache-templates-test-utils</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.chrimle</groupId>
                <artifactId>openapi-to-java-records-mustache-templates-test-common</artifactId>
                <version>${project.version}</version>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>
            <!-- / Sub-Modules -->
            <dependency>
                <!-- Needed when library=okhttp-gson -->
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>
            <dependency>
                <!-- Needed when configOptions.useJakartaEe=true -->
                <groupId>jakarta.annotation</groupId>
                <artifactId>jakarta.annotation-api</artifactId>
                <version>${jakarta.annotation-api.version}</version>
            </dependency>
            <dependency>
                <!-- Needed when configOptions.useJakartaEe=false -->
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-annotations</artifactId>
                <version>${spotbugs-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>org.openapitools</groupId>
                <artifactId>jackson-databind-nullable</artifactId>
                <version>${jackson-databind-nullable.version}</version>
            </dependency>
            <dependency>
                <!-- Needed when library=webclient -->
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson-annotations.version}</version>
            </dependency>
            <dependency>
                <!-- Needed when useBeanValidation=true -->
                <groupId>org.hibernate.validator</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${hibernate-validator.version}</version>
            </dependency>
            <!-- Needed for @Generated annotation -->
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>${javax.annotation-api.version}</version>
            </dependency>
            <!-- Needed when generateSupportingFiles=true -->
            <dependency>
                <groupId>com.squareup.okio</groupId>
                <artifactId>okio</artifactId>
                <version>${okio.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>logging-interceptor</artifactId>
                <version>${okhttp.version}</version>
            </dependency>
            <dependency>
                <groupId>io.gsonfire</groupId>
                <artifactId>gson-fire</artifactId>
                <version>${gson-fire.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring-web.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webflux</artifactId>
                <version>${spring-web.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jsr310</artifactId>
                <version>${jackson-datatype-jsr310.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Skips Deploying an Artifact -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
                <!-- Retrieves and unpacks the Custom Mustache Templates & OpenAPI Spec (for tests) -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>unpack-mustache-files</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>io.github.chrimle</groupId>
                                        <artifactId>openapi-to-java-records-mustache-templates</artifactId>
                                        <version>${project.version}</version>
                                        <type>jar</type>
                                        <overWrite>true</overWrite>
                                        <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                        <includes>
                                            templates/generateBuilders.mustache,
                                            templates/javadoc.mustache,
                                            templates/licenseInfo.mustache,
                                            templates/modelEnum.mustache,
                                            templates/pojo.mustache,
                                            templates/useBeanValidation.mustache
                                        </includes>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                        <execution>
                            <id>unpack-openapi-spec</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>io.github.chrimle</groupId>
                                        <artifactId>openapi-to-java-records-mustache-templates-test-common</artifactId>
                                        <version>${project.version}</version>
                                        <type>jar</type>
                                        <overWrite>true</overWrite>
                                        <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                        <includes>**/api.yaml</includes>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!-- Common openapi-generator-maven-plugin Version -->
                <plugin>
                    <groupId>org.openapitools</groupId>
                    <artifactId>openapi-generator-maven-plugin</artifactId>
                    <version>${openapi-generator-maven-plugin.version}</version>
                </plugin>
                <!-- Override Parent Configuration -->
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <tokenAuth>true</tokenAuth>
                        <autoPublish>true</autoPublish>
                        <excludeArtifacts>openapi-to-java-records-mustache-templates-tests,openapi-to-java-records-mustache-templates-test-common,openapi-to-java-records-mustache-templates-test-usejakartaee,openapi-to-java-records-mustache-templates-test-utils</excludeArtifacts>
                    </configuration>
                </plugin>
                <!-- Override Parent Configuration -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>${jacoco.excludes}</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>${jacoco.excludes}</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jacoco-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>${jacoco.excludes}</exclude>
                            </excludes>
                            <rules>
                                <rule>
                                    <element>PACKAGE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${jacoco-maven-plugin.minimumPackageLineCoveredRatio}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <minimum>${jacoco-maven-plugin.expectedBundleClassMissedCount}</minimum>
                                            <maximum>${jacoco-maven-plugin.expectedBundleClassMissedCount}</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <configuration>
                    <!-- Skips the spotless:apply when running in GitHub Actions -->
                    <skip>${env.CI}</skip>
                    <java>
                        <lineEndings>UNIX</lineEndings>
                        <includes>
                            <include>src/main/**/*.java</include>
                            <include>src/test/**/*.java</include>
                            <!--
                            As the `phase` is `validate`, this directory will not yet exist during `mvn clean install`.
                            However, running Spotless separately, using `mvn spotless:apply`, allows it to clean these files.
                            This is to spot discrepancies of generated classes.
                            -->
                            <include>target/generated-sources/**/*.java</include>
                        </includes>
                        <googleJavaFormat>
                            <style>GOOGLE</style>
                        </googleJavaFormat>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- === Profiles === -->
    <profiles/>
</project>
