Skip to content

Commit 1be81f2

Browse files
committedFeb 27, 2025·
feat(reporter): Replace javax usages by jakarta in the Jira REST client
When JakartaEE 9 was released in 2020 ([1]), the packages "javax.*" were migrated to "jakarta.*" ([2]). Unfortunately, the Jira REST client is still using the old package names despite an existing ticket ([3)]. This causes problem when integrating ORT in other products at this can create classpath clashes between incompatible JavaEE library versions. This commit fixes this behavior by using a Gradle plugin to transform the Jira REST client dependency to make it use the new package "jakarta" instead ([4]). Consequently, the old dependency "jakarta.ws.rs:jakarta.ws.rs-api:2.1.6" can be removed. As a tradeoff, the dependency "jersy-common" needs to be added instead to avoid running in another runtime error ([5]). [1]: https://jakarta.ee/news/jakarta-ee-9-released/ [2]: https://dev.to/tbroyer/the-javax-jakarta-mess-and-a-gradle-solution-3c44 [3]: https://ecosystem.atlassian.net/browse/JRJC-262 [4]: https://github.com/nebula-plugins/gradle-jakartaee-migration-plugin [5]: https://stackoverflow.com/a/76392371/5321324 Signed-off-by: Nicolas Nobelis <nicolas.nobelis@bosch.com>
1 parent b43803a commit 1be81f2

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed
 

‎gradle/libs.versions.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ downloadPlugin = "5.6.0"
66
gitSemverPlugin = "0.15.0"
77
graalVmNativeImagePlugin = "0.10.5"
88
ideaExtPlugin = "1.1.10"
9+
jakartaMigrationPlugin = "0.24.0"
910
kotlinPlugin = "2.1.10"
1011
ksp = "2.1.10-1.0.30"
1112
mavenPublishPlugin = "0.30.0"
@@ -32,7 +33,7 @@ hikari = "6.2.1"
3233
hoplite = "2.9.0"
3334
jackson = "2.18.2"
3435
jakartaMail = "2.0.1"
35-
jakartaRestApi = "2.1.6"
36+
jerseyCommon = "3.1.10"
3637
jgit = "7.1.0.202411261347-r"
3738
jiraRestClient = "6.0.1"
3839
jruby = "9.4.12.0"
@@ -74,6 +75,7 @@ xz = "1.10"
7475
download = { id = "de.undercouch.download", version.ref = "downloadPlugin" }
7576
gitSemver = { id = "com.github.jmongard.git-semver-plugin", version.ref = "gitSemverPlugin" }
7677
ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExtPlugin" }
78+
jakartaMigration = { id = "com.netflix.nebula.jakartaee-migration", version.ref = "jakartaMigrationPlugin" }
7779
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinPlugin" }
7880
versions = { id = "com.github.ben-manes.versions", version.ref = "versionsPlugin" }
7981

@@ -122,7 +124,7 @@ jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-d
122124
jackson-datatype-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson" }
123125
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
124126
jakartaMail = { module = "com.sun.mail:jakarta.mail", version.ref = "jakartaMail" }
125-
jakartaRestApi = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version.ref = "jakartaRestApi" }
127+
jerseyCommon = { module = "org.glassfish.jersey.core:jersey-common", version.ref = "jerseyCommon" }
126128
jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" }
127129
jgit-ssh-apache = { module = "org.eclipse.jgit:org.eclipse.jgit.ssh.apache", version.ref = "jgit" }
128130
jgit-ssh-apache-agent = { module = "org.eclipse.jgit:org.eclipse.jgit.ssh.apache.agent", version.ref = "jgit" }

‎notifier/build.gradle.kts

+9-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
plugins {
2121
// Apply precompiled plugins.
2222
id("ort-library-conventions")
23+
24+
// Apply third-party plugins.
25+
alias(libs.plugins.jakartaMigration)
26+
}
27+
28+
jakartaeeMigration {
29+
includeTransform("com.atlassian.jira:jira-rest-java-client-core")
30+
configurations.filterNot { it.isCanBeDeclared }.forEach(::transform)
2331
}
2432

2533
dependencies {
@@ -32,16 +40,7 @@ dependencies {
3240
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
3341

3442
implementation(libs.jakartaMail)
35-
36-
// Required due to https://ecosystem.atlassian.net/browse/JRJC-262.
37-
implementation(libs.jakartaRestApi)
38-
39-
constraints {
40-
implementation(libs.jakartaRestApi) {
41-
because("the JIRA REST client still needs a 2.1.x version with the javax package namespace")
42-
}
43-
}
44-
43+
implementation(libs.jerseyCommon)
4544
implementation(libs.jiraRestClient.api)
4645
implementation(libs.jiraRestClient.app) {
4746
exclude("org.apache.logging.log4j", "log4j-slf4j2-impl")

0 commit comments

Comments
 (0)
Please sign in to comment.