From a58ab2281dae52748076d3c076d94ca4555cab43 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 8 Jan 2024 12:34:36 +0100 Subject: [PATCH] Limit JavaxBeansXmlToJakartaBeansXml to beans.xml Fixes https://github.com/openrewrite/rewrite-migrate-java/issues/385 --- src/main/resources/META-INF/rewrite/jakarta-ee-10.yml | 3 +++ src/main/resources/META-INF/rewrite/jakarta-ee-9.yml | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/resources/META-INF/rewrite/jakarta-ee-10.yml b/src/main/resources/META-INF/rewrite/jakarta-ee-10.yml index 1a9372082f..f369b42bde 100644 --- a/src/main/resources/META-INF/rewrite/jakarta-ee-10.yml +++ b/src/main/resources/META-INF/rewrite/jakarta-ee-10.yml @@ -108,6 +108,9 @@ tags: - jakarta - beans - cdi +preconditions: + - org.openrewrite.FindSourceFiles: + filePattern: '**/beans.xml' recipeList: - org.openrewrite.xml.ChangeTagAttribute: attributeName: version diff --git a/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml b/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml index b0132b16d9..0d643a38d1 100644 --- a/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml +++ b/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml @@ -847,35 +847,33 @@ type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.migrate.jakarta.JavaxPersistenceXmlToJakartaPersistenceXml displayName: Migrate xmlns entries in `persistence.xml` files description: Java EE has been rebranded to Jakarta EE, necessitating an XML namespace relocation. +preconditions: + - org.openrewrite.FindSourceFiles: + filePattern: '**/persistence.xml' recipeList: - org.openrewrite.xml.ChangeTagAttribute: attributeName: name elementName: //property oldValue: javax.persistence newValue: jakarta.persistence - fileMatcher: "**/persistence.xml" - org.openrewrite.xml.ChangeTagAttribute: attributeName: version elementName: persistence newValue: 3.0 - fileMatcher: "**/persistence.xml" - org.openrewrite.xml.ChangeTagAttribute: attributeName: xmlns elementName: persistence oldValue: http://xmlns.jcp.org newValue: https://jakarta.ee - fileMatcher: "**/persistence.xml" - org.openrewrite.xml.ChangeTagAttribute: attributeName: xmlns elementName: persistence oldValue: http://java.sun.com/xml/ns/persistence newValue: https://jakarta.ee/xml/ns/persistence - fileMatcher: "**/persistence.xml" - org.openrewrite.xml.ChangeTagAttribute: attributeName: xsi:schemaLocation elementName: persistence newValue: https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd - fileMatcher: "**/persistence.xml" --- type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.migrate.jakarta.JacksonJavaxToJakarta