-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Jersey 3 and Jakarta EE 9/10 (#2919)
Motivation: Jersey, in its latest releases has adopted both Jakarta EE 9 and 10 which makes a break from the legacy JEE API. This unfortunately makes any Jersey 3 application incompatible with any Jersey 2 application. Widely-used frameworks like Spring have also adopted Jakarta EE 10. In order for ServiceTalk to support those applications, it needs to offer Jersey 3-compatible modules that ServiceTalk applications can consume. Modifications: - Add module `servicetalk-data-jackson-jersey3-jakarta9` and `-jakarta10`; - Add module `servicetalk-data-protobuf-jersey3-jakarta9` and `-jakarta10`; - Add module `servicetalk-http-router-jersey3-jakarta9` and `-jakarta10`; - Add module `servicetalk-http-router-jersey3-internal-jakarta9` and `-jakarta10`; - Add module `servicetalk-http-security-jersey3-jakarta9` and `-jakarta10`; - Update `build.gradle` in new modules to pull source from the original `-jersey` modules and replace the imports; - Add Jersey and Jakarta EE dependency versions for both 9 and 10; - Update related docs to describe how to use Jersey 3.0.x and 3.1.x Result: Applications can use the relevant new Jersey 3 modules to be compatible with Jakarta EE 9 and 10.
- Loading branch information
1 parent
e207cd2
commit a65238c
Showing
35 changed files
with
1,365 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src |
130 changes: 130 additions & 0 deletions
130
servicetalk-data-jackson-jersey3-jakarta10/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright © 2018-2019, 2021-2022, 2024 Apple Inc. and the ServiceTalk project authors | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-library" | ||
|
||
// Required version for module | ||
def javaLanguageVersion = JavaVersion.VERSION_11 | ||
|
||
if (!JavaVersion.current().isCompatibleWith(javaLanguageVersion)) { | ||
project.tasks.all { task -> task.enabled = false } | ||
} | ||
|
||
java { | ||
sourceCompatibility = javaLanguageVersion | ||
targetCompatibility = javaLanguageVersion | ||
} | ||
|
||
compileJava { | ||
options.release = Integer.parseInt(javaLanguageVersion.getMajorVersion()) | ||
} | ||
|
||
compileTestJava { | ||
options.release = compileJava.options.release | ||
} | ||
|
||
checkstyleMain { | ||
enabled false | ||
} | ||
|
||
checkstyleTest { | ||
enabled false | ||
} | ||
|
||
spotbugsMain { | ||
enabled false | ||
} | ||
|
||
spotbugsTest { | ||
enabled false | ||
} | ||
|
||
task cleanSources(type: Delete) { | ||
delete 'src' | ||
} | ||
|
||
task copySourcesForJersey3(type: Copy) { | ||
dependsOn tasks.cleanSources | ||
from '../servicetalk-data-jackson-jersey/src' | ||
into 'src' | ||
filter { line -> line.replaceAll('javax.ws.rs', 'jakarta.ws.rs') } | ||
filter { line -> line.replaceAll('javax.inject', 'jakarta.inject') } | ||
|
||
// Only modify specific javax.annotations. Some like javax.annotation.Nullable need to stay the same | ||
filter { line -> line.replaceAll('javax.annotation.Priority', 'jakarta.annotation.Priority') } | ||
} | ||
|
||
tasks.processResources.dependsOn(copySourcesForJersey3) | ||
tasks.sourcesJar.dependsOn(copySourcesForJersey3) | ||
tasks.compileJava.dependsOn(copySourcesForJersey3) | ||
tasks.processTestResources.dependsOn(copySourcesForJersey3) | ||
tasks.compileTestJava.dependsOn(copySourcesForJersey3) | ||
|
||
def actualJerseyVersion = "${jersey3VersionEE10}" | ||
def actualJavaxActivationVersion = "${javaxActivationVersionEE10}" | ||
def actualJavaxJaxbApiVersion = "${javaxJaxbApiVersionEE10}" | ||
def actualJavaxJaxbCoreVersion = "${javaxJaxbCoreVersionEE10}" | ||
def actualJavaxJaxbImplVersion = "${javaxJaxbImplVersionEE10}" | ||
def actualJaxRsVersion = "${jaxRsVersionEE10}" | ||
|
||
// Dependencies must remain consistent between servicetalk-data-jackson-jerseyX modules | ||
dependencies { | ||
api platform(project(":servicetalk-dependencies")) | ||
api platform("org.glassfish.jersey:jersey-bom:${actualJerseyVersion}") | ||
api "jakarta.activation:jakarta.activation-api:$actualJavaxActivationVersion" | ||
api "org.glassfish.jaxb:jaxb-core:$actualJavaxJaxbCoreVersion" | ||
api "jakarta.ws.rs:jakarta.ws.rs-api:$actualJaxRsVersion" | ||
api "jakarta.xml.bind:jakarta.xml.bind-api:$actualJavaxJaxbApiVersion" | ||
api "org.glassfish.jaxb:jaxb-runtime:$actualJavaxJaxbImplVersion" | ||
testImplementation enforcedPlatform("org.glassfish.jersey:jersey-bom:$actualJerseyVersion") | ||
|
||
testImplementation enforcedPlatform("org.junit:junit-bom:$junit5Version") | ||
|
||
api project(":servicetalk-data-jackson") | ||
api "jakarta.ws.rs:jakarta.ws.rs-api" // MediaType, Feature | ||
api "org.glassfish.jersey.core:jersey-common" // AutoDiscoverable | ||
|
||
implementation project(":servicetalk-annotations") | ||
implementation project(":servicetalk-buffer-netty") | ||
implementation project(":servicetalk-concurrent-api-internal") | ||
implementation project(":servicetalk-concurrent-internal") | ||
implementation project(":servicetalk-http-api") | ||
implementation project(":servicetalk-http-router-jersey3-jakarta10") | ||
implementation project(":servicetalk-http-router-jersey3-jakarta10-internal") | ||
implementation project(":servicetalk-http-utils") | ||
implementation project(":servicetalk-transport-netty") | ||
implementation "com.google.code.findbugs:jsr305" | ||
implementation "org.glassfish.jersey.core:jersey-server" | ||
implementation "org.slf4j:slf4j-api" | ||
|
||
testImplementation testFixtures(project(":servicetalk-concurrent-api")) | ||
testImplementation testFixtures(project(":servicetalk-concurrent-internal")) | ||
testImplementation testFixtures(project(":servicetalk-transport-netty-internal")) | ||
testImplementation testFixtures(project(":servicetalk-http-router-jersey3-jakarta10")) | ||
testImplementation project(":servicetalk-http-netty") | ||
testImplementation project(":servicetalk-http-router-predicate") | ||
testImplementation project(":servicetalk-test-resources") | ||
testImplementation project(":servicetalk-transport-netty-internal") | ||
|
||
testImplementation "org.junit.jupiter:junit-jupiter-api" | ||
testImplementation "org.junit.jupiter:junit-jupiter-params" | ||
testImplementation "org.junit.platform:junit-platform-suite-api:$junitPlatformVersion" | ||
testImplementation "net.javacrumbs.json-unit:json-unit:$jsonUnitVersion" | ||
testImplementation "org.glassfish.jersey.inject:jersey-hk2" | ||
testImplementation "org.glassfish.jersey.media:jersey-media-sse" | ||
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion" | ||
testImplementation "org.mockito:mockito-core:$mockitoCoreVersion" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright © 2018-2019, 2021-2022, 2024 Apple Inc. and the ServiceTalk project authors | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-library" | ||
|
||
// Required version for module | ||
def javaLanguageVersion = JavaVersion.VERSION_11 | ||
|
||
if (!JavaVersion.current().isCompatibleWith(javaLanguageVersion)) { | ||
project.tasks.all { task -> task.enabled = false } | ||
} | ||
|
||
java { | ||
sourceCompatibility = javaLanguageVersion | ||
targetCompatibility = javaLanguageVersion | ||
} | ||
|
||
compileJava { | ||
options.release = Integer.parseInt(javaLanguageVersion.getMajorVersion()) | ||
} | ||
|
||
compileTestJava { | ||
options.release = compileJava.options.release | ||
} | ||
|
||
checkstyleMain { | ||
enabled false | ||
} | ||
|
||
checkstyleTest { | ||
enabled false | ||
} | ||
|
||
spotbugsMain { | ||
enabled false | ||
} | ||
|
||
spotbugsTest { | ||
enabled false | ||
} | ||
|
||
task cleanSources(type: Delete) { | ||
delete 'src' | ||
} | ||
|
||
task copySourcesForJersey3(type: Copy) { | ||
dependsOn tasks.cleanSources | ||
from '../servicetalk-data-jackson-jersey/src' | ||
into 'src' | ||
filter { line -> line.replaceAll('javax.ws.rs', 'jakarta.ws.rs') } | ||
filter { line -> line.replaceAll('javax.inject', 'jakarta.inject') } | ||
|
||
// Only modify specific javax.annotations. Some like javax.annotation.Nullable need to stay the same | ||
filter { line -> line.replaceAll('javax.annotation.Priority', 'jakarta.annotation.Priority') } | ||
} | ||
|
||
tasks.processResources.dependsOn(copySourcesForJersey3) | ||
tasks.sourcesJar.dependsOn(copySourcesForJersey3) | ||
tasks.compileJava.dependsOn(copySourcesForJersey3) | ||
tasks.processTestResources.dependsOn(copySourcesForJersey3) | ||
tasks.compileTestJava.dependsOn(copySourcesForJersey3) | ||
|
||
def actualJerseyVersion = "${jersey3VersionEE9}" | ||
def actualJavaxActivationVersion = "${javaxActivationVersionEE9}" | ||
def actualJavaxJaxbApiVersion = "${javaxJaxbApiVersionEE9}" | ||
def actualJavaxJaxbCoreVersion = "${javaxJaxbCoreVersionEE9}" | ||
def actualJavaxJaxbImplVersion = "${javaxJaxbImplVersionEE9}" | ||
def actualJaxRsVersion = "${jaxRsVersionEE9}" | ||
|
||
// Dependencies must remain consistent between servicetalk-data-jackson-jerseyX modules | ||
dependencies { | ||
api platform(project(":servicetalk-dependencies")) | ||
api platform("org.glassfish.jersey:jersey-bom:${actualJerseyVersion}") | ||
api "jakarta.activation:jakarta.activation-api:$actualJavaxActivationVersion" | ||
api "org.glassfish.jaxb:jaxb-core:$actualJavaxJaxbCoreVersion" | ||
api "jakarta.ws.rs:jakarta.ws.rs-api:$actualJaxRsVersion" | ||
api "jakarta.xml.bind:jakarta.xml.bind-api:$actualJavaxJaxbApiVersion" | ||
api "org.glassfish.jaxb:jaxb-runtime:$actualJavaxJaxbImplVersion" | ||
testImplementation enforcedPlatform("org.glassfish.jersey:jersey-bom:$actualJerseyVersion") | ||
|
||
testImplementation enforcedPlatform("org.junit:junit-bom:$junit5Version") | ||
|
||
api project(":servicetalk-data-jackson") | ||
api "jakarta.ws.rs:jakarta.ws.rs-api" // MediaType, Feature | ||
api "org.glassfish.jersey.core:jersey-common" // AutoDiscoverable | ||
|
||
implementation project(":servicetalk-annotations") | ||
implementation project(":servicetalk-buffer-netty") | ||
implementation project(":servicetalk-concurrent-api-internal") | ||
implementation project(":servicetalk-concurrent-internal") | ||
implementation project(":servicetalk-http-api") | ||
implementation project(":servicetalk-http-router-jersey3-jakarta9") | ||
implementation project(":servicetalk-http-router-jersey3-jakarta9-internal") | ||
implementation project(":servicetalk-http-utils") | ||
implementation project(":servicetalk-transport-netty") | ||
implementation "com.google.code.findbugs:jsr305" | ||
implementation "org.glassfish.jersey.core:jersey-server" | ||
implementation "org.slf4j:slf4j-api" | ||
|
||
testImplementation testFixtures(project(":servicetalk-concurrent-api")) | ||
testImplementation testFixtures(project(":servicetalk-concurrent-internal")) | ||
testImplementation testFixtures(project(":servicetalk-transport-netty-internal")) | ||
testImplementation testFixtures(project(":servicetalk-http-router-jersey3-jakarta9")) | ||
testImplementation project(":servicetalk-http-netty") | ||
testImplementation project(":servicetalk-http-router-predicate") | ||
testImplementation project(":servicetalk-test-resources") | ||
testImplementation project(":servicetalk-transport-netty-internal") | ||
|
||
testImplementation "org.junit.jupiter:junit-jupiter-api" | ||
testImplementation "org.junit.jupiter:junit-jupiter-params" | ||
testImplementation "org.junit.platform:junit-platform-suite-api:$junitPlatformVersion" | ||
testImplementation "net.javacrumbs.json-unit:json-unit:$jsonUnitVersion" | ||
testImplementation "org.glassfish.jersey.inject:jersey-hk2" | ||
testImplementation "org.glassfish.jersey.media:jersey-media-sse" | ||
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion" | ||
testImplementation "org.mockito:mockito-core:$mockitoCoreVersion" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src |
Oops, something went wrong.