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

    <parent>
        <groupId>org.basepom</groupId>
        <artifactId>basepom-oss</artifactId>
        <version>69</version>
    </parent>

    <groupId>io.github.spannm</groupId>
    <artifactId>jackcess</artifactId>
    <version>5.1.4</version>
    <packaging>jar</packaging>

    <name>Jackcess</name>
    <description>A pure Java library for reading from and writing to MS Access databases</description>
    <url>${githubBaseUrl}${project.artifactId}</url>
    <inceptionYear>2005</inceptionYear>

    <organization>
        <name>Jackcess</name>
        <url>${project.url}</url>
    </organization>

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

    <developers>
        <developer>
            <id>${developerId}</id>
            <name>Markus Spann</name>
            <email>spannm@outlook.de</email>
            <organizationUrl>${githubBaseUrl}</organizationUrl>
            <timezone>+1</timezone>
        </developer>

        <developer>
            <name>Tim McCune</name>
            <email>javajedi@users.sf.net</email>
            <roles>
                <role>Original author and project founder</role>
                <role>Developer emeritus</role>
            </roles>
        </developer>
        <developer>
            <name>James Ahlborn</name>
            <email>jahlborn@users.sf.net</email>
            <roles>
                <role>Developer emeritus</role>
            </roles>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh//git@github.com/${developerId}/${project.artifactId}.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/${developerId}/${project.artifactId}.git</developerConnection>
        <url>https://github.com/${developerId}/${project.artifactId}/tree/master</url>
        <tag>jackcess-5.1.4</tag>
  </scm>

    <issueManagement>
        <system>Github</system>
        <url>${project.url}/issues</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <name>Sonatype Central Snapshots</name>
            <url>${basepom.deploy.snapshot.url}</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <name>Sonatype Central Staging Repository</name>
            <url>https://central.sonatype.com</url>
        </repository>
        <site>
            <id>local</id>
            <name>Local Maven site</name>
            <url>file://${java.io.tmpdir}/${project.artifactId}/site-prepared</url>
        </site>
    </distributionManagement>

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

        <!-- The minimum JDK version required to build. -->
        <project.build.systemJdk>11</project.build.systemJdk>
        <!-- The default build target. -->
        <project.build.targetJdk>11</project.build.targetJdk>

        <developerId>spannm</developerId>
        <githubBaseUrl>https://github.com/${developerId}/</githubBaseUrl>

        <dep.poi.version>5.5.1</dep.poi.version>

        <dep.slf4j.version>2.0.17</dep.slf4j.version>

        <!-- test dependencies -->
        <dep.junit.version>5.14.3</dep.junit.version>

        <dep.plugin.maven-fluido-skin.version>2.1.0</dep.plugin.maven-fluido-skin.version>

        <!-- additional plugins not defined in parent -->
        <dep.plugin.sortpom.version>4.0.0</dep.plugin.sortpom.version>
        <dep.plugin.sonar.version>5.5.0.6356</dep.plugin.sonar.version>
        <dep.plugin.cyclonedx.version>2.9.1</dep.plugin.cyclonedx.version>
        <dep.plugin.versions.version>2.21.0</dep.plugin.versions.version>

        <basepom.deploy.snapshot.url>https://central.sonatype.com/repository/maven-snapshots/</basepom.deploy.snapshot.url>

        <!-- the current "minimal" version of maven -->
        <basepom.maven.version>3.9.0</basepom.maven.version>

        <basepom.check.skip-checkstyle>false</basepom.check.skip-checkstyle>
        <basepom.check.skip-pmd>false</basepom.check.skip-pmd>
        <dep.checkstyle.version>10.26.1</dep.checkstyle.version>
        <basepom.check.skip-spotbugs>true</basepom.check.skip-spotbugs>
        <basepom.check.skip-dependency>false</basepom.check.skip-dependency>
        <basepom.check.fail-dependency>false</basepom.check.fail-dependency>

        <basepom.javadoc.skip>false</basepom.javadoc.skip>
        <basepom.javadoc.show>protected</basepom.javadoc.show>

        <basepom.site.scm.branch>master</basepom.site.scm.branch>
        <basepom.site.skip-deploy>false</basepom.site.skip-deploy>

        <basepom.check.skip-license>false</basepom.check.skip-license>
        <basepom.check.fail-license>true</basepom.check.fail-license>
        <basepom.license.skip-existing>true</basepom.license.skip-existing>
        <basepom.license.header>src/license/header.txt</basepom.license.header>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${dep.poi.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk-platform-logging</artifactId>
            <version>${dep.slf4j.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${dep.slf4j.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${dep.junit.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <defaultGoal>clean verify</defaultGoal>

        <pluginManagement>

            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <compilerArgument>-Xlint:all</compilerArgument>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <user.timezone />
                        </systemPropertyVariables>

                        <failIfNoTests>true</failIfNoTests>
                        <trimStackTrace>true</trimStackTrace>
                        <printSummary>true</printSummary>
                        <testFailureIgnore>false</testFailureIgnore>

                        <forkCount>2</forkCount>
                        <reuseForks>true</reuseForks>
                        <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
                        <parallel>classes</parallel>
                        <threadCount>8</threadCount>

                        <argLine>@{basepom.coverage.test-args} -Xmx2048m -Dfile.encoding=UTF-8</argLine>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <configLocation>src/test/resources/team/checkstyle-rules.xml</configLocation>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${dep.checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <configuration>
                        <rulesets>
                            <ruleset>src/test/resources/team/pmd-rules.xml</ruleset>
                        </rulesets>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.github.ekryd.sortpom</groupId>
                    <artifactId>sortpom-maven-plugin</artifactId>
                    <version>${dep.plugin.sortpom.version}</version>
                    <configuration>
                        <createBackupFile>false</createBackupFile>
                        <expandEmptyElements>false</expandEmptyElements>
                        <nrOfIndentSpace>4</nrOfIndentSpace>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <configuration>
                        <failIfUnknown>false</failIfUnknown>
                        <licenseSets>
                            <licenseSet>
                                <header>${basepom.license.header}</header>
                                <includes>
                                    <include>src/*/java/**</include>
                                </includes>
                                <excludes>
                                    <exclude>**/*.mdb</exclude>
                                    <exclude>**/*.accdb</exclude>
                                    <exclude>**/src/license/**</exclude>
                                    <exclude>**/target/**</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- CycloneDX Maven Plugin
                         https://cyclonedx.github.io/cyclonedx-maven-plugin -->
                    <groupId>org.cyclonedx</groupId>
                    <artifactId>cyclonedx-maven-plugin</artifactId>
                    <version>${dep.plugin.cyclonedx.version}</version>
                    <executions>
                        <execution>
                            <id>cyclonedx-makebom</id>
                            <goals>
                                <goal>makeBom</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                    <configuration>
                        <projectType>library</projectType>
                        <skipNotDeployed>false</skipNotDeployed>
                        <outputFormat>xml</outputFormat>
                        <outputName>sbom</outputName>
                        <verbose>false</verbose>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${dep.plugin.javadoc.version}</version>
                    <configuration>
                        <useStandardDocletOptions>true</useStandardDocletOptions>
                        <nocomment>false</nocomment>
                        <detectJavaApiLink>false</detectJavaApiLink>
                        <detectLinks>false</detectLinks>
                        <doclint>all,-missing</doclint>
                        <!-- add all modules of module-path so javadoc generation will
                             not fail on modularized projects (includes use of automatic module names) -->
                        <additionalOptions>
                            <option>--add-modules</option>
                            <option>ALL-MODULE-PATH</option>
                            <option>-Xmaxwarns 500</option>
                        </additionalOptions>
                    </configuration>
                </plugin>

            </plugins>

        </pluginManagement>

        <plugins>

            <plugin>
                <!-- central-publishing-maven-plugin is the official tool for publishing artifacts to the new Sonatype Central Portal -->
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>

                <!-- The <extensions>true</extensions> attribute tells Maven to include the plugin's code in the build lifecycle,
                     allowing it to hook into specific phases and extend Maven's default behavior.
                     This lets the plugin take over the standard deploy goal and implement its own logic for deploying to the new Sonatype Central Portal. -->
                <extensions>true</extensions>
                <configuration>
                    <skipPublishing>false</skipPublishing>
                    <publishingServerId>central</publishingServerId>
                    <!-- do not automatically release staged artifacts to Maven Central.
                         This is the recommended setting for releases, as it allows us to manually inspect the staged repository
                         in the Central Portal before officially publishing.
                         For Snapshots, this parameter has no effect, as they are immediately available upon deployment. -->
                    <autoPublish>false</autoPublish>

                    <!-- instructs the plugin to wait until Sonatype's portal validates the artifacts.
                         This ensures that the build doesn't complete until the artifacts have passed initial quality checks.
                         Other options like ready or published can be used to control the waiting time. -->
                    <waitUntil>validated</waitUntil>

                    <!-- let build fail if a publishing error occurs.
                         This is a crucial safety measure to prevent incomplete or incorrect artifacts from being left in a staged repository -->
                    <failOnBuildFailure>true</failOnBuildFailure>

                    <!-- generates all available checksum types (e.g., MD5, SHA-1, SHA-256) for the deployed artifacts -->
                    <checksums>all</checksums>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>true</addMavenDescriptor>
                        <compress>true</compress>
                        <index>false</index>
                        <manifest>
                            <addClasspath>false</addClasspath>
                            <addDefaultEntries>true</addDefaultEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
                            <addBuildEnvironmentEntries>true</addBuildEnvironmentEntries>
                        </manifest>
                        <manifestEntries>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                            <Project-Java-Version>${project.build.targetJdk}</Project-Java-Version>

                            <Creation-Java-Vendor>${java.vendor}</Creation-Java-Vendor>
                            <Creation-Java-Version>${java.version}</Creation-Java-Version>
                            <Creation-Java-Runtime-Name>${java.runtime.name}</Creation-Java-Runtime-Name>
                            <Creation-Java-Runtime-Version>${java.runtime.version}</Creation-Java-Runtime-Version>

                            <Creation-Os-Name>${os.name}</Creation-Os-Name>
                            <Creation-Os-Arch>${os.arch}</Creation-Os-Arch>
                            <Creation-Os-Version>${os.version}</Creation-Os-Version>
                            <Creation-User>${user.name}</Creation-User>
                            <Creation-Time>${maven.build.timestamp}</Creation-Time>

                            <Project-Description>${project.description}</Project-Description>
                            <Project-Url>${project.url}</Project-Url>
                            <Project-Inception-Year>${project.inceptionYear}</Project-Inception-Year>

                            <Organization-Name>${project.organization.name}</Organization-Name>
                            <Organization-Url>${project.organization.url}</Organization-Url>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${dep.plugin.versions.version}</version>
                <configuration>
                    <ruleSet>
                        <ignoreVersions>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>.*(?i)(alpha|beta|rc|cr|preview|milestone|[mb][0-9]+).*</version>
                            </ignoreVersion>
                        </ignoreVersions>
                    </ruleSet>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
            </plugin>

        </plugins>

    </build>

    <profiles>

        <profile>
            <id>fast</id>
            <!-- profile to skip time-consuming steps -->
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <!-- skip _compiling_ the tests -->
                <maven.test.skip>true</maven.test.skip>
                <!-- skip execution of tests -->
                <skipTests>true</skipTests>

                <maven.javadoc.skip>true</maven.javadoc.skip>
                <basepom.check.skip-extended>true</basepom.check.skip-extended>
            </properties>
        </profile>

        <profile>
            <id>github-deploy-snapshot-package</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>github</id>
                    <name>${developerId} github packages</name>
                    <url>https://maven.pkg.github.com/${developerId}/${project.artifactId}</url>
                </snapshotRepository>
            </distributionManagement>
        </profile>

        <profile>
            <!-- mvn verify -P sonarcloud -->
            <id>sonarcloud</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <sonar.skip>false</sonar.skip>
                <sonar.host.url>https://sonarcloud.io</sonar.host.url>
                <sonar.organization>${developerId}</sonar.organization>
                <sonar.projectKey>${project.groupId}:${project.artifactId}</sonar.projectKey>

                <!-- sonar.token>YOUR_TOKEN_HERE</sonar.token -->

                <basepom.test.skip>true</basepom.test.skip>
                <basepom.check.skip-all>true</basepom.check.skip-all>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>${dep.plugin.sonar.version}</version>
                        <executions>
                            <execution>
                                <id>sonar-verify</id>
                                <goals>
                                    <goal>sonar</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
