<?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>

    <!--
        Inherit the shared eu.virtualparadox quality-gate parent. It carries the active
        static-analysis / coverage / packaging gates (compiler+ErrorProne/NullAway, spotless,
        checkstyle, pmd/cpd, spotbugs+findsecbugs, forbidden-apis, jacoco, strict javadoc,
        source jars, license scan, enforcer, the static-analysis-gate antrun) plus the
        distributionManagement / release / gpg / central-publishing config (via vp-build) and
        the base dependencyManagement. managed-postgres-specific configuration that the parent
        does not provide is declared below.
    -->
    <parent>
        <groupId>eu.virtualparadox</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.0-RC3</version>
        <relativePath/>
    </parent>

    <groupId>eu.virtualparadox</groupId>
    <artifactId>managed-postgres-parent</artifactId>
    <version>1.0.0-RC3</version>
    <packaging>pom</packaging>

    <name>Managed Postgres Parent</name>
    <description>Parent reactor for managed PostgreSQL lifecycle libraries.</description>
    <url>https://github.com/virtualparadox/managed-postgres</url>
    <inceptionYear>2026</inceptionYear>

    <organization>
        <name>Virtual Paradox</name>
        <url>https://github.com/virtualparadox</url>
    </organization>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>virtualparadox</id>
            <name>Virtual Paradox maintainers</name>
            <organization>Virtual Paradox</organization>
            <organizationUrl>https://github.com/virtualparadox</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/virtualparadox/managed-postgres.git</connection>
        <developerConnection>scm:git:https://github.com/virtualparadox/managed-postgres.git</developerConnection>
        <url>https://github.com/virtualparadox/managed-postgres</url>
        <tag>HEAD</tag>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/virtualparadox/managed-postgres/issues</url>
    </issueManagement>

    <ciManagement>
        <system>GitHub Actions</system>
        <url>https://github.com/virtualparadox/managed-postgres/actions</url>
    </ciManagement>

    <modules>
        <module>managed-postgres/bom</module>
        <module>postgres-runtime/bom</module>
        <module>postgres-runtime/api</module>
        <module>managed-postgres/runtime-packager</module>
        <module>managed-postgres/core</module>
        <module>managed-postgres/cli</module>
        <module>managed-postgres/spring-boot-common</module>
        <module>managed-postgres/spring-boot-4</module>
        <module>managed-postgres/spring-boot-4-starter</module>
        <module>managed-postgres/spring-boot-3</module>
        <module>managed-postgres/spring-boot-3-starter</module>
        <module>managed-postgres/test</module>
        <module>scenario-tests/fake-runtime-it</module>
        <module>scenario-tests/real-runtime-it</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!--
            Reactor-root anchor for the centralized config/ tree (checkstyle/spotbugs/owasp
            suppressions, legal notices). The shared parent resolves analysis rule files from the
            build-config jar; managed-postgres keeps its cross-module suppression files at the
            reactor root and wires them in via the plugin overrides below.
        -->
        <root.dir>${session.executionRootDirectory}</root.dir>

        <java.version>21</java.version>

        <!-- managed-postgres-specific library/plugin versions not managed by the shared parent. -->
        <allure.version>2.34.0</allure.version>
        <allure.maven.version>3.0.1</allure.maven.version>
        <aspectj.version>1.9.25</aspectj.version>
        <japicmp.version>0.26.0</japicmp.version>
        <commons.compress.version>1.28.0</commons.compress.version>
        <picocli.version>4.7.7</picocli.version>
        <!-- Shade builds the runnable CLI fat jar; not a gate plugin, so not provided by the shared parent. -->
        <maven.shade.plugin.version>3.6.1</maven.shade.plugin.version>
        <postgresql.jdbc.version>42.7.11</postgresql.jdbc.version>
        <snakeyaml.engine.version>3.0.1</snakeyaml.engine.version>
        <spring.boot3.version>3.5.0</spring.boot3.version>
        <spring.boot4.version>4.0.6</spring.boot4.version>
        <!--
            The Spring Boot 3.5.0 BOM pins logback 1.5.18, whose POM still declares the
            Eclipse Public License v1.0 (rejected by the license allowlist). Align with the
            logback 1.5.32 that the Spring Boot 4 BOM already validates as license-clean
            (Eclipse Public License v2.0). This only adjusts the managed logback version.
        -->
        <logback.version>1.5.32</logback.version>
        <!--
            The Spring Boot 3.5.0 BOM pins log4j 2.24.3 (CVE-2026-34477, CVE-2026-34479).
            Align with the 2.25.4 release the Spring Boot 4 modules already ship, which clears
            both advisories.
        -->
        <log4j2.version>2.25.4</log4j2.version>

        <!-- Test-gate toggles consumed by the surefire/failsafe overrides and the profiles below. -->
        <surefire.excluded.groups>real-runtime</surefire.excluded.groups>
        <failsafe.excluded.groups>real-runtime</failsafe.excluded.groups>
        <managed.postgres.realRuntime.required>false</managed.postgres.realRuntime.required>
        <japicmp.skip>true</japicmp.skip>
        <!-- Default for the deployAtEnd/skip deploy config below; scenario modules override to true. -->
        <maven.deploy.skip>false</maven.deploy.skip>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Allure (test reporting) is managed-postgres-specific; not in the shared parent. -->
            <dependency>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-bom</artifactId>
                <version>${allure.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Internal reactor modules. -->
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>managed-postgres-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>managed-postgres-test</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>managed-postgres-spring-boot-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>managed-postgres-spring-boot-common</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>postgres-runtime-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- managed-postgres-specific third-party deps not managed by the shared parent. -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
                <version>${commons.compress.version}</version>
            </dependency>
            <!--
                Direct dependencyManagement entries override the imported Spring Boot 3.5.0 BOM,
                which would otherwise pin logback 1.5.18 (Eclipse Public License v1.0, rejected by
                the license allowlist). 1.5.32 is the license-clean EPL v2.0 release already
                validated by the Spring Boot 4 modules.
            -->
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <!--
                Direct overrides of the imported Spring Boot 3.5.0 BOM, which would otherwise pin
                log4j 2.24.3 (CVE-2026-34477, CVE-2026-34479). 2.25.4 is the patched release
                already shipped by the Spring Boot 4 modules.
            -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j2.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
                <version>${log4j2.version}</version>
            </dependency>
            <dependency>
                <groupId>info.picocli</groupId>
                <artifactId>picocli</artifactId>
                <version>${picocli.version}</version>
            </dependency>
            <dependency>
                <groupId>org.snakeyaml</groupId>
                <artifactId>snakeyaml-engine</artifactId>
                <version>${snakeyaml.engine.version}</version>
            </dependency>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgresql.jdbc.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>real-runtime</id>
            <properties>
                <failsafe.excluded.groups></failsafe.excluded.groups>
                <managed.postgres.realRuntime.required>true</managed.postgres.realRuntime.required>
            </properties>
        </profile>
        <profile>
            <id>api-compatibility</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>require-api-compatibility-baseline</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <skip>${japicmp.skip}</skip>
                                    <rules>
                                        <requireProperty>
                                            <property>japicmp.oldVersion</property>
                                            <message>Run API compatibility with -Djapicmp.oldVersion=&lt;released-version&gt; after installing or resolving the baseline artifacts.</message>
                                        </requireProperty>
                                    </rules>
                                    <fail>true</fail>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.github.siom79.japicmp</groupId>
                        <artifactId>japicmp-maven-plugin</artifactId>
                        <version>${japicmp.version}</version>
                        <executions>
                            <execution>
                                <id>api-compatibility</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>cmp</goal>
                                </goals>
                                <configuration>
                                    <skip>${japicmp.skip}</skip>
                                    <oldVersion>
                                        <dependency>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>${project.artifactId}</artifactId>
                                            <version>${japicmp.oldVersion}</version>
                                            <type>jar</type>
                                        </dependency>
                                    </oldVersion>
                                    <newVersion>
                                        <file>
                                            <path>${project.build.directory}/${project.build.finalName}.jar</path>
                                        </file>
                                    </newVersion>
                                    <parameter>
                                        <accessModifier>public</accessModifier>
                                        <onlyModified>true</onlyModified>
                                        <ignoreMissingClasses>true</ignoreMissingClasses>
                                        <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
                                        <breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
                                        <breakBuildBasedOnSemanticVersioning>false</breakBuildBasedOnSemanticVersioning>
                                        <excludes>
                                            <exclude>eu.virtualparadox.managedpostgres.filesystem.*</exclude>
                                            <exclude>eu.virtualparadox.managedpostgres.internal.*</exclude>
                                            <exclude>eu.virtualparadox.managedpostgres.lifecycle.*</exclude>
                                            <exclude>eu.virtualparadox.managedpostgres.metadata.*</exclude>
                                        </excludes>
                                    </parameter>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--
            Override the shared parent's OWASP `security` profile suppression wiring so the
            managed-postgres reactor-root CVE suppressions (Spring Boot lower-baseline advisories)
            still apply. The base suppression file is unpacked from build-config by the inherited
            security profile; this re-declares both files because suppressionFiles is replaced, not
            merged, by Maven configuration inheritance. Not part of the default verify (NVD scan).
        -->
        <profile>
            <id>security</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <configuration>
                            <suppressionFiles>
                                <suppressionFile>${project.build.directory}/vp-config/owasp/dependency-check-suppressions.xml</suppressionFile>
                                <suppressionFile>${root.dir}/config/security/dependency-check-suppressions.xml</suppressionFile>
                            </suppressionFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <!--
                    Release-hardening: deployAtEnd=true makes the reactor publish all modules only
                    after every module built, so a late failure cannot leave a half-published release.
                    The shared parent only version-manages maven-deploy-plugin; this mp-specific safety
                    setting is not provided there, so it is kept here. (maven.deploy.skip is honored
                    natively by the deploy plugin, letting the scenario modules opt out of deploy.)
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <deployAtEnd>true</deployAtEnd>
                        <skip>${maven.deploy.skip}</skip>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!--
                Copy the reactor-root legal notices into every module artifact's META-INF. Uses
                ${root.dir} so each module picks up the single top-level LICENSE/NOTICE/THIRD-PARTY.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-legal-notices</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${root.dir}</directory>
                                    <includes>
                                        <include>LICENSE</include>
                                        <include>NOTICE</include>
                                        <include>THIRD-PARTY-NOTICES</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--
                Override ONLY the checkstyle local-suppressions location. The shared parent points
                checkstyle.local.suppressions.file at each module's ${project.basedir}/config; managed-postgres
                instead keeps a single reactor-root suppressions file with cross-module path patterns
                (forbidInstanceof at specific classes). The base suppressions file stays inherited
                (the build-config copy unpacked under target/vp-config). The shared checkstyle.xml
                chains both SuppressionFilters, so this re-applies mp's suppressions without touching
                the gate itself.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <propertyExpansion>checkstyle.suppressions.file=${project.build.directory}/vp-config/checkstyle/suppressions.xml
checkstyle.local.suppressions.file=${root.dir}/config/static-analysis/checkstyle/suppressions.xml</propertyExpansion>
                </configuration>
            </plugin>
            <!--
                Override ONLY the spotbugs exclude filter location. managed-postgres needs its
                class-specific exclusions (command-injection on pre-split ProcessBuilder calls,
                deliberate loopback sockets in port tests, etc.). mp's file already embeds the
                generated-sources base entry, so pointing the single supported excludeFilterFile at
                the reactor-root file loses nothing the inherited base provided.
            -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <excludeFilterFile>${root.dir}/config/static-analysis/spotbugs/exclude.xml</excludeFilterFile>
                </configuration>
            </plugin>
            <!--
                Override surefire to re-add managed-postgres test needs on top of the shared parent's
                minimal config: the aspectjweaver -javaagent (combined with JaCoCo's @{surefireArgLine}
                so coverage instrumentation is preserved), the allure results directory, the
                real-runtime system property, and the excludedGroups gate.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>@{surefireArgLine} -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar</argLine>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*Tests.java</include>
                    </includes>
                    <failIfNoTests>false</failIfNoTests>
                    <skipAfterFailureCount>0</skipAfterFailureCount>
                    <rerunFailingTestsCount>0</rerunFailingTestsCount>
                    <printSummary>true</printSummary>
                    <trimStackTrace>false</trimStackTrace>
                    <excludedGroups>${surefire.excluded.groups}</excludedGroups>
                    <systemPropertyVariables>
                        <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                        <managed.postgres.realRuntime.required>${managed.postgres.realRuntime.required}</managed.postgres.realRuntime.required>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <!--
                Override failsafe to re-add the same managed-postgres test needs (aspectjweaver agent
                combined with @{failsafeArgLine}, allure dir, real-runtime property, excludedGroups).
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <argLine>@{failsafeArgLine} -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar</argLine>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/*IntegrationTest.java</include>
                    </includes>
                    <skipAfterFailureCount>0</skipAfterFailureCount>
                    <rerunFailingTestsCount>0</rerunFailingTestsCount>
                    <printSummary>true</printSummary>
                    <trimStackTrace>false</trimStackTrace>
                    <excludedGroups>${failsafe.excluded.groups}</excludedGroups>
                    <systemPropertyVariables>
                        <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                        <managed.postgres.realRuntime.required>${managed.postgres.realRuntime.required}</managed.postgres.realRuntime.required>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <!--
                Override ONLY the JaCoCo coverage excludes; managed-postgres excludes its own simple
                exception carriers / enums / CLI entry point (the shared parent's defaults target
                generic DTO/Entity packages mp does not have). The 0.90 branch+line thresholds and
                all executions stay inherited from the shared parent.
            -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                            <goal>report-integration</goal>
                        </goals>
                        <configuration>
                            <haltOnFailure>true</haltOnFailure>
                            <excludes>
                                <!-- Simple exception carriers; behavior is covered at throw sites. -->
                                <exclude>eu/virtualparadox/managedpostgres/ManagedPostgresException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresAttachException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresShutdownException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresStartupException*</exclude>
                                <!-- Simple enums and marker contracts with no behavior. -->
                                <exclude>eu/virtualparadox/managedpostgres/PostgresStatus*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/RunningPostgres*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/AttachPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/ConfigDriftPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/ManagedPostgresMode*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/StopPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/UpgradePolicy*</exclude>
                                <!-- CLI process entry point; the one-line main wraps System.exit and cannot be unit-tested. -->
                                <exclude>eu/virtualparadox/managedpostgres/cli/Main*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <!-- Simple exception carriers; behavior is covered at throw sites. -->
                                <exclude>eu/virtualparadox/managedpostgres/ManagedPostgresException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresAttachException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresShutdownException*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/PostgresStartupException*</exclude>
                                <!-- Simple enums and marker contracts with no behavior. -->
                                <exclude>eu/virtualparadox/managedpostgres/PostgresStatus*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/RunningPostgres*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/AttachPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/ConfigDriftPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/ManagedPostgresMode*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/StopPolicy*</exclude>
                                <exclude>eu/virtualparadox/managedpostgres/config/UpgradePolicy*</exclude>
                                <!-- CLI process entry point; the one-line main wraps System.exit and cannot be unit-tested. -->
                                <exclude>eu/virtualparadox/managedpostgres/cli/Main*</exclude>
                            </excludes>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.90</minimum>
                                        </limit>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.90</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Allure report generation plugin (managed-postgres-specific test reporting). -->
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>${allure.maven.version}</version>
            </plugin>
            <!--
                managed-postgres-specific release artifact audit: asserts every publishable jar
                actually carries its sources/javadoc sibling jars and the legal notices in META-INF.
                The static-analysis-gate antrun is inherited from the shared parent and is NOT
                redeclared here.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>release-artifact-audit</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target name="release-artifact-audit">
                                <condition property="release.audit.publishable.jar">
                                    <and>
                                        <equals arg1="${project.packaging}" arg2="jar"/>
                                        <not>
                                            <istrue value="${maven.deploy.skip}"/>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.main.jar.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <available file="${project.build.directory}/${project.build.finalName}.jar"/>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.sources.jar.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <available file="${project.build.directory}/${project.build.finalName}-sources.jar"/>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.javadocs.jar.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <available file="${project.build.directory}/${project.build.finalName}-javadoc.jar"/>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.license.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <resourceexists>
                                                <zipentry zipfile="${project.build.directory}/${project.build.finalName}.jar"
                                                          name="META-INF/LICENSE"/>
                                            </resourceexists>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.notice.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <resourceexists>
                                                <zipentry zipfile="${project.build.directory}/${project.build.finalName}.jar"
                                                          name="META-INF/NOTICE"/>
                                            </resourceexists>
                                        </not>
                                    </and>
                                </condition>
                                <condition property="release.audit.third.party.notices.missing">
                                    <and>
                                        <isset property="release.audit.publishable.jar"/>
                                        <not>
                                            <resourceexists>
                                                <zipentry zipfile="${project.build.directory}/${project.build.finalName}.jar"
                                                          name="META-INF/THIRD-PARTY-NOTICES"/>
                                            </resourceexists>
                                        </not>
                                    </and>
                                </condition>
                                <fail message="Release artifact audit failed for ${project.artifactId}: missing main jar ${project.build.finalName}.jar.">
                                    <condition>
                                        <isset property="release.audit.main.jar.missing"/>
                                    </condition>
                                </fail>
                                <fail message="Release artifact audit failed for ${project.artifactId}: missing source jar ${project.build.finalName}-sources.jar.">
                                    <condition>
                                        <isset property="release.audit.sources.jar.missing"/>
                                    </condition>
                                </fail>
                                <fail message="Release artifact audit failed for ${project.artifactId}: missing Javadoc jar ${project.build.finalName}-javadoc.jar.">
                                    <condition>
                                        <isset property="release.audit.javadocs.jar.missing"/>
                                    </condition>
                                </fail>
                                <fail message="Release artifact audit failed for ${project.artifactId}: main jar does not contain META-INF/LICENSE.">
                                    <condition>
                                        <isset property="release.audit.license.missing"/>
                                    </condition>
                                </fail>
                                <fail message="Release artifact audit failed for ${project.artifactId}: main jar does not contain META-INF/NOTICE.">
                                    <condition>
                                        <isset property="release.audit.notice.missing"/>
                                    </condition>
                                </fail>
                                <fail message="Release artifact audit failed for ${project.artifactId}: main jar does not contain META-INF/THIRD-PARTY-NOTICES.">
                                    <condition>
                                        <isset property="release.audit.third.party.notices.missing"/>
                                    </condition>
                                </fail>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
