Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/resources/META-INF/rewrite/java-version-11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ recipeList:
# Add an explicit JAXB/JAX-WS runtime and upgrade the dependencies to Jakarta EE 8
- org.openrewrite.java.migrate.javax.AddJaxbDependenciesWithRuntime
- org.openrewrite.java.migrate.javax.AddJaxwsDependencies
- org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin
- org.openrewrite.java.migrate.javax.AddInjectDependencies
- org.openrewrite.java.migrate.javax.AddCommonAnnotationsDependencies
# Remediate deprecations
Expand Down
36 changes: 36 additions & 0 deletions src/main/resources/META-INF/rewrite/jaxb-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright 2024 the original author or authors.
# <p>
# Licensed under the Moderne Source Available License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# <p>
# https://docs.moderne.io/licensing/moderne-source-available-license
# <p>
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin
displayName: Migrate JAXB-WS Plugin
description: Upgrade the JAXB-WS Maven plugin to be compatible with Java 11.
tags:
- java11
recipeList:
- org.openrewrite.maven.ChangePluginGroupIdAndArtifactId:
oldGroupId: org.jvnet.jax-ws-commons
oldArtifactId: jaxws-maven-plugin
newGroupId: com.sun.xml.ws
newVersion: 2.3.5
- org.openrewrite.maven.ChangePluginExecutions:
groupId: org.jvnet.jax-ws-commons
artifactId: jaxws-maven-plugin
executions: "<id>wsimport-from-jdk</id><phase>generate-sources</phase><goals><goal>wsimport</goal></goals>"
- org.openrewrite.xml.ChangeTagName:
elementName: '/project/build/plugins/plugin/executions/execution/configuration/nocompile'
newName: xnocompile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright 2025 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openrewrite.java.migrate.maven;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.maven.Assertions.pomXml;

class MigrateJaxwsMavenPluginTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipeFromResources("org.openrewrite.java.migrate.javax.MigrateJaxBWSPlugin");
}

@DocumentExample
@Test
void migrateJaxwsPluginFromJvnetToSunXmlWs() {
rewriteRun(
//language=xml
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jaxws-service</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>wsimport-from-jdk</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
<wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>STSSAPPrimingService.wsdl</wsdlFile>
</wsdlFiles>
<packageName>org.example.generated</packageName>
<keep>true</keep>
<nocompile>true</nocompile>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
""",
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>jaxws-service</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.5</version>
<executions>
<execution>
<id>wsimport-from-jdk</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
<wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>STSSAPPrimingService.wsdl</wsdlFile>
</wsdlFiles>
<packageName>org.example.generated</packageName>
<keep>true</keep>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
"""
)
);
}
}