AddJaxwsRuntime blindly injects com.sun.xml.ws:jaxws-rt into projects using Apache CXF
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Start by reading AddJaxwsRuntime.java and the AddJaxwsRuntimeMaven recipe, then inspect its tests for dependency detection. Reproduce with the provided Maven project using Apache CXF's cxf-rt-frontend-jaxws dependency. Done means the recipe avoids adding com.sun.xml.ws:jaxws-rt when an alternative JAX-WS runtime is already present, with a test covering that case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I checked out all relevant OpenRewrite repo's, fed the AI with existing recipe name and a very careful description. Antigravity with Vertex / Gemini was then tasked to check and test. .Also to create a ticket for it, using your default template. The result is shown beneath.
What version of OpenRewrite are you using?
rewrite-maven-plugin: 6.500rewrite-migrate-java: 3.49.0- Recipe:
org.openrewrite.java.migrate.javax.AddJaxwsRuntime(AddJaxwsRuntimeMaven)
How are you running OpenRewrite?
Maven plugin on a multi-module Maven project running UpgradeToJava21 (or UpgradeToJava11 / UpgradeToJava17):
What is the smallest, simplest way to reproduce the problem?
Create a project that uses Apache CXF for JAX-WS web services:
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>cxf-sample</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.5.5</version>
</dependency>
</dependencies>
</project>
Run:
mvn rewrite:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:LATEST -Drewrite.activeRecipes=org.openrewrite.java.migrate.javax.AddJaxwsRuntime
What did you expect to see?
pom.xml should not be modified.
Apache CXF provides its own JAX-WS implementation and runtime. It does not require or use the Sun/Metro reference implementation (com.sun.xml.ws:jaxws-rt).
What did you see instead?
OpenRewrite injects Sun's JAX-WS runtime into pom.xml:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.x</version>
<scope>provided</scope>
</dependency>
Root Cause
In AddJaxwsRuntime.java (AddJaxwsRuntimeMaven), the recipe checks whether jakarta.xml.ws:jakarta.xml.ws-api exists in transitive dependencies. If found, it checks only whether com.sun.xml.ws:jaxws-rt is absent.
Because Apache CXF brings in jakarta.xml.ws-api transitively, AddJaxwsRuntimeMaven assumes the project lacks a JAX-WS runtime and blindly injects com.sun.xml.ws:jaxws-rt.
This causes classpath pollution and conflicting JAX-WS SPI provider entries (META-INF/services/javax.xml.ws.spi.Provider) between Apache CXF and Sun's runtime.
Proposed Fix
Before adding com.sun.xml.ws:jaxws-rt, check whether an alternative JAX-WS runtime is already present on the classpath (e.g. org.apache.cxf:cxf-rt-frontend-jaxws, org.apache.cxf:cxf-rt-transports-http, or Spring WS).
What is the full stack trace of any errors you encountered?
N/A (semantic defect resulting in conflicting dependency injection).
- Lenguaje dominante
- Java
- Estrellas
- 159
- Forks
- 130
- Merge medio
- 7 h 49 min
- PR fusionados (30 d)
- 60
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openrewrite/rewrite-migrate-java
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openrewrite/rewrite-migrate-java#1305 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
openrewrite/rewrite-migrate-java#1319 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
openrewrite/rewrite-migrate-java#1310 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
openrewrite/rewrite-migrate-java#1307 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
openrewrite/rewrite-migrate-java#1304 ·
Los mantenedores suelen responder en 1 día
Todos los issues de openrewrite/rewrite-migrate-java
Issues similares
-
human-required sync-failed
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/osdu-spi-file#63 ·
Los mantenedores suelen responder en 1 día
-
frontend quick win
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CodeForPhilly/benefit-decision-toolkit#571 ·
Los mantenedores suelen responder en 1 día
-
approved
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
checkstyle/checkstyle#22129 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Add Hardcharger JDBC driverPosiblemente ocupada @prmoore77 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día