<?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>tools.jackson</groupId>
    <artifactId>jackson-bom</artifactId>
    <version>3.0.0-rc2</version>
  </parent>
  <artifactId>jackson-base</artifactId>
  <name>Jackson Base</name>
  <packaging>pom</packaging>
  <description>Parent pom for components of Jackson dataprocessor: includes base settings as well
as consistent set of dependencies across components.
NOTE: NOT to be used by components outside of Jackson: application code should only rely on `jackson-bom`
  </description>
  <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>
  <properties>
    <!--
     | For automatically generating PackageVersion.java. Your child pom.xml must define
     | packageVersion.dir and packageVersion.package, and must set the phase of the
     | process-packageVersion execution of maven-replacer-plugin to 'generate-sources'.
    -->
    <packageVersion.template.input>${basedir}/src/main/java/${packageVersion.dir}/PackageVersion.java.in</packageVersion.template.input>
    <packageVersion.template.output>${generatedSourcesDir}/${packageVersion.dir}/PackageVersion.java</packageVersion.template.output>

    <!-- 09-Sep-2017, tatu: Jackson 3.x is Java 8 and above only. While it would be possible
         to support earlier versions for some components (annotations, core streaming),
         this is one simplification we can do
    -->
    <!-- 03-Dec-2024, tatu: as per [databind#4820] it's JDK 8 for all except for jackson-annotations
      -->
    <javac.src.version>17</javac.src.version>
    <javac.target.version>17</javac.target.version>
    <javac.debuglevel>lines,source,vars</javac.debuglevel>

    <maven.compiler.source>${javac.src.version}</maven.compiler.source>
    <maven.compiler.target>${javac.target.version}</maven.compiler.target>

    <moditect.sourceGroup>${project.groupId}</moditect.sourceGroup>
    <moditect.sourceArtifact>${project.artifactId}</moditect.sourceArtifact>
    <moditect.sourceVersion>${project.version}</moditect.sourceVersion>

    <!-- To fix [jackson-bom#52] need to first use better default version for
         parent pom, and then also allow override as need be
      -->
    <jackson-bom.version>${project.parent.version}</jackson-bom.version>
  </properties>

  <!-- 13-Jul-2022, tatu: Jackson 3.x now at the "new" Sonatype OSS repo -->
  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots-new</id>
      <name>Sonatype Nexus Snapshots (new)</name>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>

    <repository>
      <id>sonatype-nexus-staging-new</id>
      <name>Nexus Release Repository (new)</name>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <dependencyManagement>
    <dependencies>
      <!-- Test dep versions -->
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.assertj}</version>
        <scope>test</scope>
      </dependency>
      <!-- JUnit4 still used for many components (but not core) -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${version.junit}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${version.junit5}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

    </dependencies>
  </dependencyManagement>
  
  <build>
    <pluginManagement>
      <plugins>

        <!-- Verify existence of certain settings
          -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <executions>
            <execution>
              <id>enforce-java</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
              <rules>
                <requireJavaVersion>
                  <version>1.8.0</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>[3.6,)</version>
                  <message>[ERROR] The currently supported version of Maven is 3.6 or higher</message>
                </requireMavenVersion>
                <requirePluginVersions>
                  <banLatest>true</banLatest>
                  <banRelease>true</banRelease>
                  <banSnapshots>true</banSnapshots>
                  <phases>clean,deploy,site</phases>
                  <message>[ERROR] Best Practice is to always define plugin versions!</message>
                </requirePluginVersions>
              </rules>
	         </configuration>
            </execution>
            <execution>
              <id>enforce-properties</id>
              <phase>validate</phase>

<!-- important! Do NOT enable here since parent does not define, build would fail
    BUT: alas means child has specify settings for phase AND goals like so:
              <phase>validate</phase>
              <goals>
		<goal>enforce</goal>
              </goals>
-->
              <configuration>
                <rules>
                  <!-- Needed both for Replacer plug-in AND for Automatic Module Name -->
                  <requireProperty>
                    <property>packageVersion.package</property>
                  </requireProperty>
                  <requireProperty>
                    <property>packageVersion.dir</property>
                  </requireProperty>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${version.plugin.javadoc}</version>
          <configuration>
            <!-- Disable Javadoc warnings? -->
            <failOnError>false</failOnError>
            <links>
              <link>https://docs.oracle.com/en/java/javase/17/docs/api</link>
            </links>
          </configuration>
        </plugin>

        <!-- Set up replacer but do not invoke (it's pom, after all);
             however, phase etc are all defined.
          -->
        <plugin>
          <groupId>com.google.code.maven-replacer-plugin</groupId>
          <artifactId>replacer</artifactId>
          <executions>
            <execution>
              <id>process-packageVersion</id>
              <goals>
                <goal>replace</goal>
              </goals>
              <phase>generate-sources</phase>
            </execution>
          </executions>
          <configuration>
            <file>${packageVersion.template.input}</file>
            <outputFile>${packageVersion.template.output}</outputFile>
            <replacements>
              <replacement>
                <token>@package@</token>
                <value>${packageVersion.package}</value>
              </replacement>
              <replacement>
                <token>@projectversion@</token>
                <value>${project.version}</value>
              </replacement>
              <replacement>
                <token>@projectgroupid@</token>
                <value>${project.groupId}</value>
              </replacement>
              <replacement>
                <token>@projectartifactid@</token>
                <value>${project.artifactId}</value>
              </replacement>
            </replacements>
          </configuration>
        </plugin>

        <!-- 26-Feb-2025, tatu: Should no longer be needed in general,
             but left for possible exceptional cases
          -->
        <plugin>
          <groupId>org.moditect</groupId>
          <artifactId>moditect-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>add-module-infos</id>
              <phase>package</phase>
              <goals>
                <goal>add-module-info</goal>
              </goals>
              <configuration>
                <overwriteExistingFiles>true</overwriteExistingFiles>
                <module>
                  <moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
                </module>
              </configuration>
            </execution>
          </executions>
          <!-- 22-Feb-2021, tatu: For Jackson 2.13+, put `module-info.class` 
              under "META-INF/versions/11" (instead of root, /); helps pre-Java9
              libraries, frameworks, as well as avoids warnings by tooling
            -->
          <!-- 27-Jan-2022, tatu: as per [databind#3380] etc, really need to use
               "META-INF/versions/9" for tooling compatibility
            -->
          <!-- 03-Dec-2024, tatu: should soon no longer need moditect but
	         for now, put under 17
            -->
          <configuration>
            <jvmVersion>17</jvmVersion>
          </configuration>
        </plugin>

        <!-- 19-Sep-2017, tatu: Or, if Cobertura fails with Java 8....
          -->
        <plugin>
	     <groupId>org.jacoco</groupId>
	     <artifactId>jacoco-maven-plugin</artifactId>
	     <executions>
            <execution>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>report</id>
              <phase>verify</phase>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- 26-Jan-2025, tatu: Added via [jackson-bom#85] for 2.19/3.0
          -->
        <plugin>
          <groupId>org.gradlex</groupId>
          <artifactId>gradle-module-metadata-maven-plugin</artifactId>
          <version>1.0.1</version>
          <executions>
            <execution>
              <goals>
                <goal>gmm</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <!-- When multiple Jackson modules of different versions are combined through transitive dependencies,
               the following configuration ensures that the versions are aligned to the highest Jackson version in
               the dependency graph.
               For further details, refer to: https://blog.gradle.org/alignment-with-gradle-module-metadata -->
            <platformDependencies>
              <dependency>
                <groupId>tools.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson-bom.version}</version>
              </dependency>
            </platformDependencies>
          </configuration>
        </plugin>


        <!-- 03-Nov-2020, tatu: For 2.12, defaults for better LICENSE inclusion -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>add-resource</id>
              <phase>generate-resources</phase>
              <goals>
                <goal>add-resource</goal>
              </goals>
              <configuration>
                <resources>
                  <resource>
                    <directory>${project.basedir}</directory>
                    <targetPath>META-INF</targetPath>
                    <includes>
                      <include>LICENSE</include>
                    </includes>
                  </resource>
                </resources>
              </configuration>
            </execution>
            <!-- 04-May-2024, tatu: For [core#1264] need "cleansed" version
              -->
            <execution>
              <id>regex-property</id>
              <!-- default phase is "validate" as per https://www.mojohaus.org/build-helper-maven-plugin/usage.html
                -->
              <goals>
                <goal>regex-property</goal>
              </goals>
              <configuration>
                <name>project.version.underscore</name>
                <value>${project.version}</value>
                <regex>\.</regex>
                <replacement>_</replacement>
                <failIfNoMatch>true</failIfNoMatch>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <!-- 27-Nov-2022, tatu: [bom#56] Configure Felix-bundle and maven-jar plugins to
           use fixed Timestamp correctly for included class files (needed for Reproducible
           Builds)
	     -->
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <executions>
            <execution>
              <id>bundle-manifest</id>
              <phase>process-classes</phase>
              <goals>
                <goal>manifest</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- 12-Oct-2019, tatu: Copied from
            https://github.com/stephenc/git-timestamp-maven-plugin/blob/master/pom.xml#L327-L337
        -->
      <!-- 13-Jul-2022, tatu: Updated to the "new" Sonatype OSS repo -->
      <plugin>
         <groupId>org.sonatype.plugins</groupId>
         <artifactId>nexus-staging-maven-plugin</artifactId>
         <version>1.7.0</version>
         <extensions>true</extensions>
         <configuration>
           <serverId>sonatype-nexus-staging-new</serverId>
           <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
	   <!-- 07-Mar-2025, tatu: NOTE! Diff from Jackson 2.x -->
           <stagingProfileId>1a90e652fbcfb</stagingProfileId>
         </configuration>
       </plugin>
    </plugins>
  </build>

  <!-- 08-Mar-2019, tatu: Add option to generate `module-info.java` with Moditect
        under profile `moditect`
    -->
  <profiles>
    <profile>
      <id>moditect</id>
      <properties>
        <!-- Not only do we need JDK 9+, must target later JDK too -->
        <java.version>1.9</java.version>
        <javac.src.version>${java.version}</javac.src.version>
        <javac.target.version>${java.version}</javac.target.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-module-info</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>generate-module-info</goal>
                </goals>
                <configuration>
                  <modules>
                    <module>
                      <artifact>
                        <groupId>${moditect.sourceGroup}</groupId>
                        <artifactId>${moditect.sourceArtifact}</artifactId>
                        <version>${moditect.sourceVersion}</version>
                      </artifact>
                    </module>
                  </modules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
