Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ repositories {
/**
* The version of Jackson used by `buildSrc`.
*
* Please keep this value in sync with [io.spine.dependency.lib.Jackson.version].
* It is not a requirement but would be good in terms of consistency.
* This value is deliberately decoupled from [io.spine.dependency.lib.Jackson.version],
* which now points to Jackson 3.x. The `buildSrc` sources still use the Jackson 2.x API
* (`com.fasterxml.jackson.*`), so they must stay on a 2.x version until they are migrated
* to `tools.jackson.*`. Any maintained 2.x release will do — bump this only when `buildSrc`
* itself needs a fix from a later 2.x, not to track the newest one.
*/
val jacksonVersion = "2.18.3"

Expand Down
81 changes: 59 additions & 22 deletions buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,31 @@ package io.spine.dependency.lib
import io.spine.dependency.Dependency
import io.spine.dependency.DependencyWithBom

// https://github.com/FasterXML/jackson/wiki/Jackson-Releases
@Suppress("unused")
/**
* Jackson library dependencies.
*
* Jackson 3.x uses the `tools.jackson` group ID and the matching `tools.jackson.*`
* packages (JSTEP-1). The sole exception is `jackson-annotations`: Jackson 3.x keeps
* consuming the 2.x artifact, so both its coordinates and its
* `com.fasterxml.jackson.annotation` package stay unchanged.
*
* See:
* - [Jackson Releases](https://github.com/FasterXML/jackson/wiki/Jackson-Releases)
* - [Migrating to Jackson 3](https://github.com/FasterXML/jackson/blob/main/jackson3/MIGRATING_TO_JACKSON_3.md)
*/
@Suppress("unused", "ConstPropertyName")
object Jackson : DependencyWithBom() {
override val group = "com.fasterxml.jackson"
override val version = "2.22.1"

// https://github.com/FasterXML/jackson-annotations?tab=readme-ov-file#release-notes
override val group = "tools.jackson"
override val version = "3.2.1"

/**
* The version of `jackson-annotations`, which Jackson 3.x deliberately keeps
* on the 2.x line.
*
* Must match the `jackson.version.annotations` property declared by the [bom].
*
* See: https://github.com/FasterXML/jackson-annotations?tab=readme-ov-file#release-notes
*/
const val annotationsVersion = "2.22"

// https://github.com/FasterXML/jackson-bom
Expand All @@ -54,19 +72,23 @@ object Jackson : DependencyWithBom() {
val databind = "$coreGroup:jackson-databind"

// https://github.com/FasterXML/jackson-annotations
val annotations = "$coreGroup:jackson-annotations:$annotationsVersion"
val annotations = "com.fasterxml.jackson.core:jackson-annotations:$annotationsVersion"

// https://github.com/FasterXML/jackson-module-kotlin/releases
val moduleKotlin = "$moduleGroup:jackson-module-kotlin"

// https://github.com/FasterXML/jackson-modules-java8
@Deprecated(
"The module was merged into `jackson-databind` in Jackson 3.0" +
" and is no longer published.",
ReplaceWith("Jackson.databind", "io.spine.dependency.lib.Jackson"),
level = DeprecationLevel.ERROR
)
val moduleParameterNames = "$moduleGroup:jackson-module-parameter-names"

override val modules = listOf(
core,
databind,
moduleKotlin,
moduleParameterNames
moduleKotlin
)

object DataFormat : Dependency() {
Expand All @@ -81,10 +103,13 @@ object Jackson : DependencyWithBom() {
// https://github.com/FasterXML/jackson-dataformats-text/releases
val yaml = "$group:$infix-yaml"

// https://github.com/FasterXML/jackson-dataformats-binary/tree/3.x/protobuf
val protobuf = "$group:$infix-protobuf"

val xmlArtifact = "$xml:$version"
val yamlArtifact = "$yaml:$version"

override val modules = listOf(xml, yaml)
override val modules = listOf(xml, yaml, protobuf)
}

object DataType : Dependency() {
Expand All @@ -93,38 +118,50 @@ object Jackson : DependencyWithBom() {

private const val infix = "jackson-datatype"

// https://github.com/FasterXML/jackson-modules-java8
@Deprecated(
"The module was merged into `jackson-databind` in Jackson 3.0" +
" and is no longer published.",
ReplaceWith("Jackson.databind", "io.spine.dependency.lib.Jackson"),
level = DeprecationLevel.ERROR
)
val jdk8 = "$group:$infix-jdk8"

// https://github.com/FasterXML/jackson-modules-java8/tree/2.19/datetime
@Deprecated(
"The module was merged into `jackson-databind` in Jackson 3.0" +
" and is no longer published.",
ReplaceWith("Jackson.databind", "io.spine.dependency.lib.Jackson"),
level = DeprecationLevel.ERROR
)
val dateTime = "$group:$infix-jsr310"

// https://github.com/FasterXML/jackson-datatypes-collections/blob/2.19/guava
// https://github.com/FasterXML/jackson-datatypes-collections/tree/3.x/guava
val guava = "$group:$infix-guava"

// https://github.com/FasterXML/jackson-dataformats-binary/tree/2.19/protobuf
@Deprecated(
"Protobuf support is a data format, not a data type." +
" The `$infix-protobuf` artifact has never been published.",
ReplaceWith("Jackson.DataFormat.protobuf", "io.spine.dependency.lib.Jackson"),
level = DeprecationLevel.ERROR
)
val protobuf = "$group:$infix-protobuf"

// https://github.com/FasterXML/jackson-datatypes-misc/tree/2.19/javax-money
// https://github.com/FasterXML/jackson-datatypes-misc/tree/3.x/javax-money
val javaXMoney = "$group:$infix-javax-money"

// https://github.com/FasterXML/jackson-datatypes-misc/tree/2.19/moneta
// https://github.com/FasterXML/jackson-datatypes-misc/tree/3.x/moneta
val moneta = "$group:jackson-datatype-moneta"

override val modules = listOf(
jdk8,
dateTime,
guava,
protobuf,
javaXMoney,
moneta
)
}

// https://github.com/FasterXML/jackson-jr
// https://github.com/FasterXML/jackson-jr/tree/3.x
object Junior : Dependency() {
override val version = Jackson.version
override val group = "com.fasterxml.jackson.jr"
override val group = "$groupPrefix.jr"

val objects = "$group:jackson-jr-objects"

Expand Down
Loading
Loading