Skip to content

Commit aef46fb

Browse files
committed
migrate jaxws-maven-plugin to 2.5.X
1 parent 926d84d commit aef46fb

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed

src/main/resources/META-INF/rewrite/java-version-11.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ recipeList:
3737
# Add an explicit JAXB/JAX-WS runtime and upgrade the dependencies to Jakarta EE 8
3838
- org.openrewrite.java.migrate.javax.AddJaxbDependenciesWithRuntime
3939
- org.openrewrite.java.migrate.javax.AddJaxwsDependencies
40+
- org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin
4041
- org.openrewrite.java.migrate.javax.AddInjectDependencies
4142
- org.openrewrite.java.migrate.javax.AddCommonAnnotationsDependencies
4243
# Remediate deprecations
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Copyright 2024 the original author or authors.
3+
# <p>
4+
# Licensed under the Moderne Source Available License (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# <p>
8+
# https://docs.moderne.io/licensing/moderne-source-available-license
9+
# <p>
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
---
18+
type: specs.openrewrite.org/v1beta/recipe
19+
name: org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin
20+
displayName: Migrate JAXB-WS Plugin
21+
description: Upgrade the JAXB-WS Maven plugin to be compatible with Java 11
22+
tags:
23+
- java11
24+
recipeList:
25+
- org.openrewrite.maven.ChangePluginGroupIdAndArtifactId:
26+
oldGroupId: org.jvnet.jax-ws-commons
27+
oldArtifactId: jaxws-maven-plugin
28+
newGroupId: com.sun.xml.ws
29+
newVersion: 2.3.5
30+
- org.openrewrite.maven.ChangePluginExecutions:
31+
groupId: org.jvnet.jax-ws-commons
32+
artifactId: jaxws-maven-plugin
33+
executions: "<id>wsimport-from-jdk</id><phase>generate-sources</phase><goals><goal>wsimport</goal></goals>"
34+
- org.openrewrite.xml.ChangeTagName:
35+
elementName: /plugin/executions/execution/configuration/nocompile
36+
newName: xnocompile
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright 2025 the original author or authors.
3+
* <p>
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* <p>
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openrewrite.java.migrate.maven;
17+
18+
import org.junit.jupiter.api.Test;
19+
import org.openrewrite.DocumentExample;
20+
import org.openrewrite.config.Environment;
21+
import org.openrewrite.test.RecipeSpec;
22+
import org.openrewrite.test.RewriteTest;
23+
24+
import static org.openrewrite.maven.Assertions.pomXml;
25+
26+
class MigrateJaxwsMavenPluginTest implements RewriteTest {
27+
28+
@Override
29+
public void defaults(RecipeSpec spec) {
30+
spec.recipeFromResources("org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin");
31+
}
32+
33+
@DocumentExample
34+
@Test
35+
void migrateJaxwsPluginFromJvnetToSunXmlWs() {
36+
rewriteRun(
37+
//language=xml
38+
pomXml(
39+
"""
40+
<project>
41+
<modelVersion>4.0.0</modelVersion>
42+
<groupId>com.example</groupId>
43+
<artifactId>jaxws-service</artifactId>
44+
<version>1.0.0</version>
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.jvnet.jax-ws-commons</groupId>
49+
<artifactId>jaxws-maven-plugin</artifactId>
50+
<version>2.1</version>
51+
<executions>
52+
<execution>
53+
<id>wsimport-from-jdk</id>
54+
<goals>
55+
<goal>wsimport</goal>
56+
</goals>
57+
<configuration>
58+
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
59+
<wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>
60+
<wsdlFiles>
61+
<wsdlFile>STSSAPPrimingService.wsdl</wsdlFile>
62+
</wsdlFiles>
63+
<packageName>org.example.generated</packageName>
64+
<keep>true</keep>
65+
<nocompile>true</nocompile>
66+
<verbose>true</verbose>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
</project>
74+
""",
75+
"""
76+
<project>
77+
<modelVersion>4.0.0</modelVersion>
78+
<groupId>com.example</groupId>
79+
<artifactId>jaxws-service</artifactId>
80+
<version>1.0.0</version>
81+
<build>
82+
<plugins>
83+
<plugin>
84+
<groupId>com.sun.xml.ws</groupId>
85+
<artifactId>jaxws-maven-plugin</artifactId>
86+
<version>2.3.5</version>
87+
<executions>
88+
<execution>
89+
<id>wsimport-from-jdk</id>
90+
<goals>
91+
<goal>wsimport</goal>
92+
</goals>
93+
<configuration>
94+
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
95+
<wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>
96+
<wsdlFiles>
97+
<wsdlFile>STSSAPPrimingService.wsdl</wsdlFile>
98+
</wsdlFiles>
99+
<packageName>org.example.generated</packageName>
100+
<keep>true</keep>
101+
<xnocompile>true</xnocompile>
102+
<verbose>true</verbose>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
</plugins>
108+
</build>
109+
</project>
110+
"""
111+
)
112+
);
113+
}
114+
}

0 commit comments

Comments
 (0)