openrewrite / rewrite-migrate-java

OpenRewrite recipes for migrating to newer versions of Java.
Apache License 2.0
92 stars 67 forks source link

Jakarta: EE10 faces-config.xml and taglib.xml upgrade #370

Closed melloware closed 7 months ago

melloware commented 7 months ago

Upgrade Faces config file from legacy version to new 4.0 version.

EE8:

<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="
        http://xmlns.jcp.org/xml/ns/javaee
        http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<facelet-taglib version="2.2" 
    xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd">

EE10:

<faces-config
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="https://jakarta.ee/xml/ns/jakartaee"
        xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
        version="4.0"
>
<facelet-taglib
    xmlns="https://jakarta.ee/xml/ns/jakartaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facelettaglibrary_3_0.xsd"
    version="3.0"
>
timtebeek commented 7 months ago

Since these are XML files we can likely already support these by adding additional configured recipes of https://docs.openrewrite.org/recipes/xml/changetagattribute to most likely https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/resources/META-INF/rewrite/jakarta-ee-10.yml Feel free to start a draft PR for those!

melloware commented 7 months ago

I think I got it let me do some testing and submit a PR.

melloware commented 7 months ago

Tested and submitted in that same PR. Works great! I followed the Javax.Persistence.Xml example you already had and it was a big help