diff --git a/src/main/resources/META-INF/rewrite/ibm-java.yml b/src/main/resources/META-INF/rewrite/ibm-java.yml
index 9ee9d9c7b3..c7fcbf4268 100644
--- a/src/main/resources/META-INF/rewrite/ibm-java.yml
+++ b/src/main/resources/META-INF/rewrite/ibm-java.yml
@@ -27,6 +27,8 @@ recipeList:
- org.openrewrite.java.migrate.JREDoNotUseSunNetSslInternalWwwProtocol
- org.openrewrite.java.migrate.JREDoNotUseSunNetSslInternalSslProvider
- org.openrewrite.java.migrate.JREDoNotUseSunNetSslAPIs
+ - org.openrewrite.java.migrate.RemovedJavaXMLWSModuleProvided
+ - org.openrewrite.java.migrate.RemovedJaxBModuleProvided
---
type: specs.openrewrite.org/v1beta/recipe
@@ -110,4 +112,34 @@ recipeList:
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: com.ibm.security.auth.module.Krb5LoginModule
newFullyQualifiedTypeName: com.sun.security.auth.module.Krb5LoginModule
- ignoreDefinition: true
\ No newline at end of file
+ ignoreDefinition: true
+---
+type: specs.openrewrite.org/v1beta/recipe
+name: org.openrewrite.java.migrate.RemovedJavaXMLWSModuleProvided
+displayName: Do not use `java.xml.ws` module in WebSphere Liberty
+description:
+ The `java.xml.ws` module was removed in Java11. Websphere Liberty provides its own implementation of the module, which can be used by specifying the `jaxws-2.2` feature in the server.xml file.
+ This recipe removes the `javax.xml.ws` module from the application's build dependency in favor of the Websphere Liberty implementation to avoid class loading issues.
+tags:
+ - java11
+recipeList:
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax.xml.ws
+ artifactId: jaxws-api
+---
+type: specs.openrewrite.org/v1beta/recipe
+name: org.openrewrite.java.migrate.RemovedJaxBModuleProvided
+displayName: Do not use `java.xml.bind` and `java.activation` modules in WebSphere Liberty
+description:
+ The `java.xml.bind` and `java.activation` modules were removed in Java11.
+ Websphere Liberty provides its own implementation of the modules, which can be used by specifying the `jaxb-2.2` feature in the server.xml file.
+ This recipe removes the `javax.xml.bind` and `javax.activation` modules from the application's build dependency in favor of the Websphere Liberty implementation to avoid class loading issues.
+tags:
+ - java11
+recipeList:
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax.xml.bind
+ artifactId: jaxb-api
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax.activation
+ artifactId: activation
\ No newline at end of file
diff --git a/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java b/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
index 4d55850731..312376d442 100644
--- a/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
@@ -22,8 +22,12 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
+import static org.openrewrite.gradle.Assertions.buildGradle;
+import static org.openrewrite.gradle.toolingapi.Assertions.withToolingApi;
import static org.openrewrite.java.Assertions.java;
import static org.openrewrite.java.Assertions.version;
+import static org.openrewrite.maven.Assertions.pomXml;
+
class IBMSemeruTest implements RewriteTest {
@Override
@@ -289,4 +293,266 @@ public boolean verify(String arg0, String arg1) {
), 6)
);
}
+
+ @Test
+ void removeMavenXMLWSModuleDependency() {
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+ 4.0.0
+ com.mycom.myapp
+ myapp
+ 2.0.0
+ war
+ MyApp
+
+ 1.8
+ 1.8
+ UTF-8
+ 2.0.0
+ UTF-8
+
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.10.1
+
+
+ javax.xml.ws
+ jaxws-api
+ 2.2
+
+
+
+
+
+ maven-war-plugin
+ 3.1.0
+
+ false
+ pom.xml, src/, target/, WebContent/
+ WebContent
+
+
+ src/main/resources
+ WEB-INF/classes
+
+
+
+
+
+
+
+ """,
+ """
+
+ 4.0.0
+ com.mycom.myapp
+ myapp
+ 2.0.0
+ war
+ MyApp
+
+ 1.8
+ 1.8
+ UTF-8
+ 2.0.0
+ UTF-8
+
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.10.1
+
+
+
+
+
+ maven-war-plugin
+ 3.1.0
+
+ false
+ pom.xml, src/, target/, WebContent/
+ WebContent
+
+
+ src/main/resources
+ WEB-INF/classes
+
+
+
+
+
+
+
+ """
+ )
+ );
+ }
+
+ @Test
+ void gradleDependencyXMLWSModuleExclusion() {
+ rewriteRun(
+ spec -> spec.beforeRecipe(withToolingApi())
+ .recipeFromResource("/META-INF/rewrite/ibm-java.yml", "org.openrewrite.java.migrate.RemovedJavaXMLWSModuleProvided"),
+ //language=groovy
+ buildGradle(
+ """
+ plugins {
+ id 'java-library'
+ }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ implementation("org.springframework.boot:spring-boot-starter-web:2.7.0") {
+ exclude group: "junit"
+ }
+ implementation("javax.xml.ws:jaxws-api:2.0")
+ testImplementation "org.junit.vintage:junit-vintage-engine:5.6.2"
+ }
+ """,
+ """
+ plugins {
+ id 'java-library'
+ }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ implementation("org.springframework.boot:spring-boot-starter-web:2.7.0") {
+ exclude group: "junit"
+ }
+ testImplementation "org.junit.vintage:junit-vintage-engine:5.6.2"
+ }
+ """
+ )
+ );
+ }
+
+ @Test
+ void removeMavenXMLJaxBModuleDependency() {
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+ 4.0.0
+ com.mycom.myapp
+ myapp
+ 2.0.0
+ war
+ MyApp
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.10.1
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
+
+
+ javax.activation
+ activation
+ 1.1.1
+
+
+
+ """,
+ """
+
+ 4.0.0
+ com.mycom.myapp
+ myapp
+ 2.0.0
+ war
+ MyApp
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+
+
+ com.google.code.gson
+ gson
+ 2.10.1
+
+
+
+ """
+ )
+ );
+ }
+
+ @Test
+ void gradleDependencyXMLJaxBModuleExclusion() {
+ rewriteRun(
+ spec -> spec.beforeRecipe(withToolingApi())
+ .recipeFromResource("/META-INF/rewrite/ibm-java.yml", "org.openrewrite.java.migrate.RemovedJaxBModuleProvided"),
+ //language=groovy
+ buildGradle(
+ """
+ plugins {
+ id 'java-library'
+ }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ implementation("org.springframework.boot:spring-boot-starter-web:2.7.0") {
+ exclude group: "junit"
+ }
+ implementation("javax.xml.bind:jaxb-api:2.3.1")
+ implementation("javax.activation:activation:1.1.1")
+ testImplementation "org.junit.vintage:junit-vintage-engine:5.6.2"
+ }
+ """,
+ """
+ plugins {
+ id 'java-library'
+ }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ implementation("org.springframework.boot:spring-boot-starter-web:2.7.0") {
+ exclude group: "junit"
+ }
+ testImplementation "org.junit.vintage:junit-vintage-engine:5.6.2"
+ }
+ """
+ )
+ );
+ }
}