<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.intechcore</groupId>
    <artifactId>polarion-compatibility-maven-plugin</artifactId>
    <version>0.1.2</version>
    <packaging>maven-plugin</packaging>

    <!-- Maven 3 reads the minimum from here. The requiredMavenVersion below is the Maven 4
         mechanism, which that release honours in preference to this element and earlier
         releases ignore. Both are needed to state one requirement to every Maven. -->
    <prerequisites>
        <maven>${maven.min.version}</maven>
    </prerequisites>

    <name>Polarion Compatibility Maven Plugin</name>
    <description>Maven plugin that fails the build when a Polarion extension bundles classes referencing legacy javax packages</description>
    <url>https://github.com/intechcore/polarion-compatibility-maven-plugin</url>

    <organization>
        <name>Intechcore GmbH</name>
        <url>https://intechcore.com</url>
    </organization>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Sergey Grigoriev</name>
            <organization>Intechcore GmbH</organization>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/intechcore/polarion-compatibility-maven-plugin.git</connection>
        <developerConnection>scm:git:ssh://github.com:intechcore/polarion-compatibility-maven-plugin.git</developerConnection>
        <url>https://github.com/intechcore/polarion-compatibility-maven-plugin</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <url>https://central.sonatype.com/repository/maven-snapshots</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com</url>
        </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- A fixed timestamp makes the published jars byte for byte reproducible. The bump
             workflow rewrites it at release time, so it names the moment of the release. -->
        <project.build.outputTimestamp>2026-09-02T11:02:00Z</project.build.outputTimestamp>
        <maven.compiler.release>21</maven.compiler.release>
        <maven.min.version>3.6.3</maven.min.version>

        <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-plugin.version>0.11.0</central-publishing-plugin.version>
        <jacoco-maven-plugin.version>0.8.15</jacoco-maven-plugin.version>
        <sonar-maven-plugin.version>5.7.0.6970</sonar-maven-plugin.version>
        <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
        <maven-invoker-plugin.version>3.10.1</maven-invoker-plugin.version>

        <maven-plugin-api.version>3.9.16</maven-plugin-api.version>
        <maven-plugin-annotations.version>3.15.2</maven-plugin-annotations.version>
        <maven-plugin-plugin.version>3.15.2</maven-plugin-plugin.version>

        <jetbrains-annotations.version>26.1.0</jetbrains-annotations.version>
        <asm.version>9.10.1</asm.version>

        <junit.version>6.1.3</junit.version>
        <assertj.version>3.27.7</assertj.version>

        <!-- SonarCloud -->
        <sonar.projectKey>intechcore_polarion-compatibility-maven-plugin</sonar.projectKey>
        <sonar.organization>intechcore</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.coverage.exclusions>src/test/**</sonar.coverage.exclusions>
        <sonar.exclusions>target/generated-sources/**</sonar.exclusions>
    </properties>

    <dependencies>
        <!-- Maven Plugin API -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven-plugin-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven-plugin-annotations.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven-plugin-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Bytecode analysis. Polarion's own gate uses ASM, so the scan matches it. -->
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
        </dependency>

        <!-- Static analysis annotations -->
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>${jetbrains-annotations.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin-plugin.version}</version>
                <configuration>
                    <goalPrefix>polarion-compatibility</goalPrefix>
                    <requiredJavaVersion>${maven.compiler.release}</requiredJavaVersion>
                    <requiredMavenVersion>${maven.min.version}</requiredMavenVersion>
                </configuration>
                <executions>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*IT.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <configuration>
                    <!-- maven-plugin-plugin generates HelpMojo. It is not ours to test, and
                         counting it would put the 100% coverage this project holds out of reach. -->
                    <excludes>
                        <exclude>**/HelpMojo.class</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>${sonar-maven-plugin.version}</version>
            </plugin>
            <!-- The javadoc jar goes to Maven Central, so a missing tag is a published
                 defect. The plugin used to run in the release profile alone, which meant
                 the warnings first appeared during a release. Check on every build and
                 fail on a warning; the release profile adds only the jar goal. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <failOnWarnings>true</failOnWarnings>
                    <!-- The generated HelpMojo has an undocumented default constructor. -->
                    <excludePackageNames>com.intechcore.polarion_compatibility_maven_plugin</excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <id>check-javadoc</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>javadoc-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- The unit tests build the goal with new CheckMojo() and set the parameters by
                 reflection, so nothing there exercises the plugin descriptor, the @Parameter
                 defaults Maven's configurator applies, or the binding to the verify phase. These
                 run the goal from a real pom in a real build instead. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>${maven-invoker-plugin.version}</version>
                <configuration>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <postBuildHookScript>verify</postBuildHookScript>
                    <streamLogs>false</streamLogs>
                    <showErrors>true</showErrors>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>install</goal>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <consoleOutput>true</consoleOutput>
                    <failOnViolation>true</failOnViolation>
                    <violationSeverity>warning</violationSeverity>
                </configuration>
                <executions>
                    <execution>
                        <id>checkstyle</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>published</waitUntil>
                            <waitMaxTime>3600</waitMaxTime>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
