THRIFT-5700: Migrate to JakartaEE and Apache HttpComponents 5 (#2746)

- Migrate to JakartaEE and Apache HttpComponents 5
- Modify C code to choose which namespace choose for "Generated" annotations (jakarta by default)
diff --git a/lib/java/gradle/environment.gradle b/lib/java/gradle/environment.gradle
index 8c14a52..977c07e 100644
--- a/lib/java/gradle/environment.gradle
+++ b/lib/java/gradle/environment.gradle
@@ -61,8 +61,8 @@
 
 dependencies {
     implementation "org.slf4j:slf4j-api:${slf4jVersion}"
-    implementation "org.apache.httpcomponents:httpclient:${httpclientVersion}"
-    implementation "org.apache.httpcomponents:httpcore:${httpcoreVersion}"
+    implementation "org.apache.httpcomponents.client5:httpclient5:${httpclientVersion}"
+    implementation "org.apache.httpcomponents.core5:httpcore5:${httpcoreVersion}"
     implementation "jakarta.servlet:jakarta.servlet-api:${servletVersion}"
     implementation "jakarta.annotation:jakarta.annotation-api:${javaxAnnotationVersion}"
     implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
diff --git a/lib/java/gradle/generateTestThrift.gradle b/lib/java/gradle/generateTestThrift.gradle
index 10bb16b..7e33b15 100644
--- a/lib/java/gradle/generateTestThrift.gradle
+++ b/lib/java/gradle/generateTestThrift.gradle
@@ -38,7 +38,7 @@
 // Code generation for Unit Testing
 
 // A callable closure to make this easier
-ext.thriftCompile = { Task task, String thriftFileName, String generator = 'java', File outputDir = genSrc ->
+ext.thriftCompile = { Task task, String thriftFileName, String generator = 'java:jakarta_annotations', File outputDir = genSrc ->
     def thriftFile = file("$thriftRoot/test/$thriftFileName")
     if (!thriftFile.exists()) {
         thriftFile = file("$projectDir/src/test/resources/$thriftFileName")
@@ -98,7 +98,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'JavaOptionTypeJdk8Test.thrift', 'java:option_type=jdk8', genOptionTypeJdk8Src)
+    thriftCompile(it, 'JavaOptionTypeJdk8Test.thrift', 'java:option_type=jdk8,jakarta_annotations', genOptionTypeJdk8Src)
 }
 
 task generateBeanJava(group: 'Build') {
@@ -107,7 +107,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'JavaBeansTest.thrift', 'java:beans,nocamel,future_iface', genBeanSrc)
+    thriftCompile(it, 'JavaBeansTest.thrift', 'java:beans,nocamel,future_iface,jakarta_annotations', genBeanSrc)
 }
 
 task generateReuseJava(group: 'Build') {
@@ -116,7 +116,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'FullCamelTest.thrift', 'java:fullcamel,future_iface', genFullCamelSrc)
+    thriftCompile(it, 'FullCamelTest.thrift', 'java:fullcamel,future_iface,jakarta_annotations', genFullCamelSrc)
 }
 
 task generateFullCamelJava(group: 'Build') {
@@ -125,7 +125,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'ReuseObjects.thrift', 'java:reuse_objects', genReuseSrc)
+    thriftCompile(it, 'ReuseObjects.thrift', 'java:reuse_objects,jakarta_annotations', genReuseSrc)
 }
 
 task generateUnsafeBinariesJava(group: 'Build') {
@@ -134,7 +134,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'UnsafeTypes.thrift', 'java:unsafe_binaries', genUnsafeSrc)
+    thriftCompile(it, 'UnsafeTypes.thrift', 'java:unsafe_binaries,jakarta_annotations', genUnsafeSrc)
 }
 
 task generateWithAnnotationMetadata(group: 'Build') {
@@ -143,7 +143,7 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'JavaAnnotationTest.thrift', 'java:annotations_as_metadata', genSrc)
+    thriftCompile(it, 'JavaAnnotationTest.thrift', 'java:annotations_as_metadata,jakarta_annotations', genSrc)
 }
 
 task generateJavaDefinitionOrderTestJava(group: 'Build') {
@@ -152,6 +152,6 @@
 
     ext.outputBuffer = new ByteArrayOutputStream()
 
-    thriftCompile(it, 'JavaDefinitionOrderA.thrift', 'java', genDefinitionOrderTestASrc)
-    thriftCompile(it, 'JavaDefinitionOrderB.thrift', 'java', genDefinitionOrderTestBSrc)
+    thriftCompile(it, 'JavaDefinitionOrderA.thrift', 'java:jakarta_annotations', genDefinitionOrderTestASrc)
+    thriftCompile(it, 'JavaDefinitionOrderB.thrift', 'java:jakarta_annotations', genDefinitionOrderTestBSrc)
 }