<?xml version="1.0" encoding="UTF-8"?>
<!--
  /**
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements. See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership. The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License. You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing,
   * software distributed under the License is distributed on an
   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   * KIND, either express or implied. See the License for the
   * specific language governing permissions and limitations
   * under the License.
   */
-->
<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.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>9</version>
  </parent>

  <groupId>org.tomitribe</groupId>
  <artifactId>oss-parent</artifactId>
  <packaging>pom</packaging>
  <version>9</version>

  <name>Tomitribe :: Open Source Parent POM</name>
  <url>http://www.tomitribe.com/</url>
  <organization>
    <name>Tomitribe Corporation</name>
    <url>http://www.tomitribe.com/</url>
  </organization>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <inceptionYear>2025</inceptionYear>

  <scm>
    <connection>scm:git:git@github.com:tomitribe/tomitribe-oss-parent.git</connection>
    <url>scm:git:git@github.com:tomitribe/tomitribe-oss-parent.git</url>
    <developerConnection>scm:git:git@github.com:tomitribe/tomitribe-oss-parent.git</developerConnection>
    <tag>oss-parent-9</tag>
  </scm>

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

    <!--WARNING: Never reference these properties outside of this pom, especially not in children-->
    <maven.checkstyle.plugin.version>3.6.0</maven.checkstyle.plugin.version>
  </properties>

  <prerequisites>
    <maven>3.6.3</maven>
  </prerequisites>

  <build>
    <pluginManagement>
      <plugins>
        <!-- set versions of common plugins for reproducibility, ordered alphabetically -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.11.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!--
        - Make a checkstyle violation a compile error. Note that if a compile error occurs,
        - further information can be found in target/site/checkstyle.html (present even when
        - just the compile goal and not the site goal has been run). Note also that child
        - projects may redeclare this plugin and provide different configuration settings
        - to use different checks (more or less strict than the default).

      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>31.1-jre</version>
          </dependency>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>10.21.4</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>verify-style</id>
            <phase>process-classes</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <logViolationsToConsole>true</logViolationsToConsole>
          <consoleOutput>true</consoleOutput>
          <checkstyleRules>
            <module name="Checker">
              <property name="severity" value="error" />

              <module name="FileLength">
                <property name="max" value="1500" />
                <property name="fileExtensions" value="java" />
              </module>

              <module name="FileTabCharacter" />

              <module name="SuppressWithNearbyTextFilter">
                <property name="nearbyTextPattern" value="CHECKSTYLE (\w+)" />
                <property name="checkPattern" value="$1" />
              </module>

              <module name="SuppressWithPlainTextCommentFilter">
                <property name="offCommentFormat" value="// CHECKSTYLE\:OFF ?([\w\|]+)" />
                <property name="onCommentFormat" value="// CHECKSTYLE\:ON ?([\w\|]+)" />
                <property name="checkFormat" value="$1" />
              </module>

              <module name="TreeWalker">

                <module name="SuppressionCommentFilter" />

                <module name="ConstantName">
                  <property name="format" value="^(_?[a-z][a-zA-Z0-9]*|([A-Z](_?[A-Z0-9]+)*))$" />
                </module>

                <module name="LocalVariableName" />
                <module name="MethodName">
                  <property name="format" value="^_?[a-z][a-zA-Z0-9]*$" />
                </module>
                <module name="PackageName" />
                <module name="LocalFinalVariableName" />
                <module name="ParameterName" />
                <module name="StaticVariableName" />
                <module name="TypeName">
                  <property name="format" value="^_?[A-Z][a-zA-Z0-9]*$" />
                </module>

                <module name="AvoidStarImport">
                  <property name="excludes" value="java.io,java.net,java.util" />
                </module>

                <module name="IllegalImport">
                  <property name="illegalPkgs" value="sun.management,sun.usagetracker,sun.reflect,sun.launcher,sun.jar,sun.print,sun.java2d,sun.font,sun.rmi,sun.util,sun.instrument,sun.applet,sun.swing,sun.invoke,sun.audio,sun.net,sun.dc,sun.corba,sun.tracing,sun.security,sun.lwawt,sun.awt" />
                </module>

                <module name="RedundantImport" />
                <module name="UnusedImports" />

                <module name="MethodLength">
                  <property name="max" value="250" />
                </module>

                <module name="ParameterNumber">
                  <property name="max" value="10" />
                </module>

                <module name="EmptyBlock">
                  <property name="option" value="text" />
                </module>

                <module name="NeedBraces">
                  <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE" />
                </module>

                <module name="LeftCurly">
                  <property name="option" value="eol" />
                </module>

                <module name="RightCurly">
                  <property name="option" value="same" />
                </module>

                <module name="EmptyStatement" />
                <module name="EqualsHashCode" />
                <module name="DefaultComesLast" />
                <module name="MissingSwitchDefault" />
                <module name="MultipleVariableDeclarations" />

                <module name="DesignForExtension">
                  <property name="severity" value="ignore" />
                </module>

                <!--
                -->
                <module name="HideUtilityClassConstructor">
                  <property name="ignoreAnnotatedBy" value="java.lang.Deprecated" />
                </module>

                <module name="VisibilityModifier">
                  <property name="packageAllowed" value="false" />
                  <property name="protectedAllowed" value="true" />
                  <property name="publicMemberPattern" value="^serialVersionUID" />
                  <property name="severity" value="warning" />
                </module>

                <module name="UpperEll" />
              </module>
            </module>
          </checkstyleRules>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.16.1</version>
        <configuration>
          <includes>
            <include>src/**/*.java</include>
            <include>src/**/*.xml</include>
            <include>pom.xml</include>
          </includes>
          <excludes>
            <exclude>**/*/MANIFEST.MF</exclude>
            <exclude>.git</exclude>
            <exclude>.gitignore</exclude>
            <exclude>derby.log</exclude>
            <exclude>**/META-INF/services/*</exclude>
            <exclude>**/bootstrap-*</exclude>
            <exclude>**/js/jquery-*</exclude>
            <exclude>**/*.json</exclude>
            <exclude>src/test/resources/**</exclude>
            <exclude>src/*/resources/META-INF/beans.xml</exclude>
            <!-- json can't get comments -->
          </excludes>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release>17</release>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkCount>2C</forkCount>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <useReleaseProfile>false</useReleaseProfile>
          <goals>deploy</goals>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

</project>

