<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>eu.virtualparadox</groupId>
        <artifactId>vp-build</artifactId>
        <version>1.0.0-RC2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>build-config</artifactId>
    <packaging>jar</packaging>

    <name>Virtual Paradox Build Config</name>
    <description>Shared static-analysis rule files (checkstyle, pmd, spotbugs, forbidden-apis, license, owasp) consumed by the parent's plugin configuration.</description>

    <!--
        DELIBERATELY this module does NOT inherit eu.virtualparadox:parent (the gate-bearing POM).
        The parent's quality-gate plugins declare build-config itself as a plugin dependency to read
        the rule files; if build-config inherited the parent, a clean build (empty ~/.m2) would be
        circular - build-config would have to be resolved before it is built. By inheriting the
        gate-free vp-build aggregator instead, build-config carries NO analysis gates and builds
        first, so the parent's plugins can then resolve it from the reactor. This is the fix for the
        clean-machine circular-build bug; do not "unify" build-config under the gate parent.

        This module ships only static-analysis rule files plus one marker class (BuildConfig: final,
        single private constructor) so the artifact carries a public API + non-empty sources/javadoc
        jars, which Maven Central requires for non-POM artifacts.
    -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>21</java.version>
        <maven.compiler.release>${java.version}</maven.compiler.release>

        <maven.compiler.plugin.version>3.15.0</maven.compiler.plugin.version>
        <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.12.0</maven.javadoc.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <release>${maven.compiler.release}</release>
                </configuration>
            </plugin>
            <!-- Central requires sources + javadoc jars for non-POM artifacts. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
