Skip to content
Tatu Saloranta edited this page Mar 28, 2022 · 6 revisions

Welcome to the jackson-bom wiki!

Gradle Module Metadata

Support for Gradle Module Metadata (GMM) was added in Jackson 2.12.

Support is enabled by adding following fragment in pom.xml of a component, right after opening <project>:

  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->

(and before following <modelVersion> tag)

This will generate file

target/publications/maven/module.json

when mvn clean package (or similar) is executed. This does depend on project having jackson-base as its parent pom, or including similar set up for GMM maven plugin:

<build>
  <plugins>
    <plugin>
      <groupId>de.jjohannes</groupId>
      <artifactId>gradle-module-metadata-maven-plugin</artifactId>
      <version>0.2.0</version>
      <executions>
    </plugin>
  </plugins>
</build>

For verifying goodness of GMM: (courtesy of @jjohannes):

If you ever want to test something manually yourself. You can do:

1. Create a folder with two empty files `settings.gradle.kts` and `build.gradle.kts`
2. Put this into `build.gradle.kts`

plugins {
    id("java-library")
}

repositories {
    mavenCentral()
}

dependencies {
    // change dependencies and versions here to see effects
    implementation(platform("com.fasterxml.jackson:jackson-bom:2.12.6.20220326"))
    implementation("com.fasterxml.jackson.core:jackson-databind")
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf")
}

3. Run `gradle :dependencies --configuration compileClasspath --scan`

You can look at the  dependencies tree printed to console or open the _Build Scan Link_ and explore the results in the browser.
Clone this wiki locally