Skip to content

Commit 866b433

Browse files
cjobinabocjobinab
andauthored
Update Module provided recipes to use the provided scope (#725)
Co-authored-by: cjobinab <[email protected]>
1 parent 648c5c2 commit 866b433

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

src/main/resources/META-INF/rewrite/ibm-java.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,33 @@ recipeList:
117117
---
118118
type: specs.openrewrite.org/v1beta/recipe
119119
name: org.openrewrite.java.migrate.RemovedJavaXMLWSModuleProvided
120-
displayName: Do not use `java.xml.ws` module in WebSphere Liberty
120+
displayName: Do not package `java.xml.ws` module in WebSphere Liberty applications
121121
description:
122122
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.
123-
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.
123+
This recipe updates the `javax.xml.ws` dependency to use the `provided` scope to avoid class loading issues.
124124
tags:
125125
- java11
126126
recipeList:
127-
- org.openrewrite.java.dependencies.RemoveDependency:
127+
- org.openrewrite.maven.ChangeDependencyScope:
128128
groupId: javax.xml.ws
129129
artifactId: jaxws-api
130+
newScope: provided
130131
---
131132
type: specs.openrewrite.org/v1beta/recipe
132133
name: org.openrewrite.java.migrate.RemovedJaxBModuleProvided
133-
displayName: Do not use `java.xml.bind` and `java.activation` modules in WebSphere Liberty
134+
displayName: Do not package `java.xml.bind` and `java.activation` modules in WebSphere Liberty applications
134135
description:
135136
The `java.xml.bind` and `java.activation` modules were removed in Java11.
136137
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.
137-
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.
138+
This recipe updates the `javax.xml.bind` and `javax.activation` dependencies to use the `provided` scope to avoid class loading issues.
138139
tags:
139140
- java11
140141
recipeList:
141-
- org.openrewrite.java.dependencies.RemoveDependency:
142+
- org.openrewrite.maven.ChangeDependencyScope:
142143
groupId: javax.xml.bind
143144
artifactId: jaxb-api
144-
- org.openrewrite.java.dependencies.RemoveDependency:
145+
newScope: provided
146+
- org.openrewrite.maven.ChangeDependencyScope:
145147
groupId: javax.activation
146148
artifactId: activation
149+
newScope: provided

src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,12 @@ void removeMavenXMLWSModuleDependency() {
382382
<artifactId>gson</artifactId>
383383
<version>2.10.1</version>
384384
</dependency>
385+
<dependency>
386+
<groupId>javax.xml.ws</groupId>
387+
<artifactId>jaxws-api</artifactId>
388+
<version>2.2</version>
389+
<scope>provided</scope>
390+
</dependency>
385391
</dependencies>
386392
<build>
387393
<plugins>
@@ -425,16 +431,6 @@ void gradleDependencyXMLWSModuleExclusion() {
425431
dependencies {
426432
implementation("javax.xml.ws:jaxws-api:2.0")
427433
}
428-
""",
429-
"""
430-
plugins {
431-
id 'java-library'
432-
}
433-
repositories {
434-
mavenCentral()
435-
}
436-
dependencies {
437-
}
438434
"""
439435
)
440436
);
@@ -500,6 +496,18 @@ void removeMavenXMLJaxBModuleDependency() {
500496
<artifactId>gson</artifactId>
501497
<version>2.10.1</version>
502498
</dependency>
499+
<dependency>
500+
<groupId>javax.xml.bind</groupId>
501+
<artifactId>jaxb-api</artifactId>
502+
<version>2.3.1</version>
503+
<scope>provided</scope>
504+
</dependency>
505+
<dependency>
506+
<groupId>javax.activation</groupId>
507+
<artifactId>activation</artifactId>
508+
<version>1.1.1</version>
509+
<scope>provided</scope>
510+
</dependency>
503511
</dependencies>
504512
</project>
505513
"""
@@ -525,16 +533,6 @@ void gradleDependencyXMLJaxBModuleExclusion() {
525533
implementation("javax.xml.bind:jaxb-api:2.3.1")
526534
implementation("javax.activation:activation:1.1.1")
527535
}
528-
""",
529-
"""
530-
plugins {
531-
id 'java-library'
532-
}
533-
repositories {
534-
mavenCentral()
535-
}
536-
dependencies {
537-
}
538536
"""
539537
)
540538
);

0 commit comments

Comments
 (0)