AddJaxwsRuntime recipe injects legacy JAX-WS 2.3 runtime on JAX-WS 4.0 / Jakarta projects, causing a dependency resolution conflict
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 40/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start with the AddJaxwsRuntime recipe in the wsee package, which adds com.sun.xml.ws:jaxws-rt:2.3.7 with provided scope when JAX-WS or JAXB usages are found. Reproduce with a project that imports jakarta.xml.ws and jakarta.xml.soap and check the effective POM before and after the recipe runs. Done means the recipe either skips when Jakarta 4.x APIs are already declared or injects a compatible runtime, and the project compiles. The maintainers have not yet chosen between the two options in the issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
TL;DR The change results in a compile error
With 6.21.0 no changes were made. It was noticed with 6.49.0 and also exist in 6.50. Hence in the past I didn't need aan tag. Did some digging and got the AIto summarize the findings. See below.
Describe the bug
The org.openrewrite.java.migrate.wsee.AddJaxwsRuntime recipe injects the JAX-WS 2.3 runtime (com.sun.xml.ws:jaxws-rt:2.3.7) with provided scope when JAX-WS or JAXB API usages are detected.
While this recipe is intended to provide a JAX-WS runtime for environments running on Java 11+ (where JAX-WS was removed from the JDK), it introduces a dependency resolution conflict on modern projects that have already migrated to
JAX-WS 4.0 / Jakarta EE 9+ (e.g., Micronaut 4.x applications utilizing the jakarta.xml.ws.* namespace).
Comparing the Maven Effective POM before and after the recipe's modification reveals that injecting jaxws-rt:2.3.7 transitively pulls in legacy javax-based API jars under the jakarta GroupID (specifically
jakarta.xml.ws:jakarta.xml.ws-api:2.3.3 and jakarta.xml.soap:jakarta.xml.soap-api:1.4.2).
Because these legacy dependencies are introduced as transitive dependencies of a direct provided scope dependency (jaxws-rt:2.3.7), Maven's dependency resolution prioritizes them over the project's modern, compile-scope
jakarta.xml.ws-api:4.0.1 and jakarta.xml.soap-api:3.0.1 API jars. This downgrades the API jars to versions that lack the jakarta.* packages, resulting in compilation failures for hand-written source files that import jakarta.xml.ws.*
or jakarta.xml.soap.*.
The Technical Mechanism (Verified via Effective POM comparison)
A detailed comparison of the Maven Effective POM configurations (mvn help:effective-pom) before and after applying the recipe demonstrates the dependency resolution conflict:
- Before the recipe (effective-without.xml):
The project is running on Micronaut 4.x / Java 21, and successfully resolves the modern Jakarta XML Web Services 4.0 API:
1
2 jakarta.xml.ws
3 jakarta.xml.ws-api
4 4.0.1
5 compile
6
All source files import jakarta.xml.ws.* and jakarta.xml.soap.* and compile successfully as a compatible runtime (e.g., Apache CXF 4.x) is transitively present.
-
After the recipe (effective-with.xml):
The recipe injects com.sun.xml.ws:jaxws-rt:2.3.7 (implementing JAX-WS 2.3).
This runtime transitively depends on legacy API jars:- jakarta.xml.ws:jakarta.xml.ws-api:2.3.3 (containing the legacy
javax.namespace)* - jakarta.xml.soap:jakarta.xml.soap-api:1.4.2 (containing the legacy
javax.namespace)*
Maven's dependency resolution prioritizes these transitive paths under the provided scope, downgrading the compile-scope jakarta.xml.ws-api:4.0.1 and jakarta.xml.soap-api:3.0.1 API jars.
- jakarta.xml.ws:jakarta.xml.ws-api:2.3.3 (containing the legacy
-
Compilation Impact:
Because the legacy 2.3.3 and 1.4.2 API jars do not contain the jakarta namespace classes, the jakarta packages are no longer present on the compile classpath, causing compilation to fail.
Compiler Failure Output
1 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.16.0:compile (default-compile) on project sirivm-swarco-source: Compilation failure:
2 [ERROR] /src/main/java/.../SwarcoSiriVmXmlDecoderActor.java: package jakarta.xml.soap does not exist
3 [ERROR] /src/main/java/.../SwarcoSiriVmXmlDecoderActor.java: cannot find symbol: class SOAPMessage
4 [ERROR] /src/main/java/.../SwarcoSubscriberActor.java: package jakarta.xml.ws does not exist
5 [ERROR] /src/main/java/.../SwarcoSubscriberActor.java: cannot find symbol: class Holder
Suggested Resolution
The AddJaxwsRuntime recipe could benefit from namespace awareness and check for existing JAX-WS 4.x / JAXB 4.x declarations:
- Check existing API namespace: The recipe could check if jakarta.xml.ws-api (version 4.x+) is already declared and resolved, and skip execution if found.
- Compatible Runtime Injection: If a runtime must be added, the recipe should detect the active namespace. If jakarta.* is used, it should inject a compatible Jakarta XML Web Services 4.0 runtime (such as
com.sun.xml.ws:jaxws-rt:4.0.x) instead of the legacy javax-based 2.3.7 version.
Environment
- OpenRewrite Maven Plugin: 6.49.0
- Active Recipes: org.openrewrite.java.migrate.wsee.AddJaxwsRuntime
- Framework: Micronaut 4.x (latest iirc)
- Java Version: 21
1
- Ngôn ngữ chính
- Java
- Star
- 156
- Fork
- 129
- Merge trung bình
- 7 giờ 12 phút
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openrewrite/rewrite-migrate-java
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
openrewrite/rewrite-migrate-java#1289 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
openrewrite/rewrite-migrate-java#1246 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
openrewrite/rewrite-migrate-java#1227 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
OptionalNotPresentToIsEmpty rewrites `!isPresent()` on a non-`java.util.Optional` type, producing uncompilable `isEmpty()`Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
openrewrite/rewrite-migrate-java#1146 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
openrewrite/rewrite-migrate-java#1119 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openrewrite/rewrite-migrate-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug new windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS podspec depends on `React-Codegen`, which resolves to an unrelated pod on CocoaPods trunkĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
GantMan/jail-monkey#380 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
objectionary/jucs#145 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
objectionary/lints#1559 ·
Maintainer thường phản hồi trong vòng 2 ngày