$npx -y skills add omnifaces/claude-faces-expert --skill faces-migrateMigrate a Jakarta Faces project from one version to another (e.g. JSF 2.3 to Faces 4.1)
| 1 | *Version 1.3.0* |
| 2 | |
| 3 | Migrate the current project to Jakarta Faces `$ARGUMENTS` (if no argument, ask the developer for the target version). |
| 4 | |
| 5 | ## Step 1: Detect Current Version |
| 6 | |
| 7 | Determine the current Faces version from: |
| 8 | - `pom.xml` or `build.gradle` dependencies (look for `javax.faces`, `jakarta.faces`, `jsf-api`, `myfaces-api`). |
| 9 | - `faces-config.xml` version attribute. |
| 10 | - XML namespaces in XHTML files (`java.sun.com` = JSF 1.0+, `xmlns.jcp.org` = JSF 2.2+, `jakarta.faces` = Faces 4.0+). |
| 11 | - Package imports in Java files (`javax.faces` = JSF 1.x/2.x vs `jakarta.faces` = Faces 3.0+). |
| 12 | |
| 13 | Also determine the **runtime type**: |
| 14 | - **Full EE server** (WildFly, GlassFish, TomEE, Payara, WebSphere, Liberty, etc.): Faces, CDI, BV, EJB, JPA, JAX-RS, etc. are all provided by the runtime; the project should depend on the Java EE / Jakarta EE API artifact with `<scope>provided</scope>`, not on standalone implementations. |
| 15 | - **Barebones servlet container** (Tomcat, Jetty, Undertow, etc.) or **framework** (Spring Boot): Tomcat only provides Servlet, JSP, EL, WebSocket, and JASIC; everything else (Faces, CDI, BV, JSTL, etc.) must be installed/bundled separately with the application. |
| 16 | |
| 17 | When updating dependencies in migration steps, update the appropriate artifact: |
| 18 | - On a full EE server: update the EE API version and ensure the target server version supports the target Faces version. |
| 19 | - Java EE 8 (JSF 2.3): `javax:javaee-web-api:8.0` with `<scope>provided</scope>` |
| 20 | - Jakarta EE 9 (Faces 3.0): `jakarta.platform:jakarta.jakartaee-web-api:9.0.0` with `<scope>provided</scope>` |
| 21 | - Jakarta EE 10 (Faces 4.0): `jakarta.platform:jakarta.jakartaee-web-api:10.0.0` with `<scope>provided</scope>` |
| 22 | - Jakarta EE 11 (Faces 4.1): `jakarta.platform:jakarta.jakartaee-web-api:11.0.0` with `<scope>provided</scope>` |
| 23 | - On a barebones servlet container: update the standalone Faces implementation version directly (e.g. `org.glassfish:jakarta.faces` for Mojarra, `org.apache.myfaces.core:myfaces-impl` for MyFaces); do NOT use `javaee-api` or `jakarta.jakartaee-api` as a substitute because it will allow compiling against APIs that the servlet container doesn't actually provide. |
| 24 | |
| 25 | Report the detected version and runtime type, and confirm with the developer before proceeding. |
| 26 | |
| 27 | ## Step 2: Determine Migration Path |
| 28 | |
| 29 | Based on source → target version, apply the relevant steps below. |
| 30 | Multiple steps may apply for multi-version jumps (e.g. JSF 2.0 → Faces 4.1 requires all intermediate steps). |
| 31 | |
| 32 | ## Migration Steps |
| 33 | |
| 34 | ### JSF 1.x → JSF 2.0+ (major rewrite) |
| 35 | |
| 36 | This is a significant migration; confirm scope with developer before proceeding. |
| 37 | |
| 38 | - Replace JSP files with Facelets (XHTML). |
| 39 | - Replace `<f:view>`, `<f:subview>` with Facelets templating (`<ui:composition>`, `<ui:define>`). |
| 40 | - Replace `<managed-bean>` entries in `faces-config.xml` with `@ManagedBean` + scope annotations (will be migrated to `@Named` in later step). |
| 41 | - Replace `<navigation-rule>` entries in `faces-config.xml` with return values from action methods or `?faces-redirect=true`. |
| 42 | - Replace `javax.faces.webapp.FacesServlet` URL pattern `/faces/*` or `*.faces` or `*.jsf` with `*.xhtml`. |
| 43 | |
| 44 | ### JSF 2.x → JSF 2.3 (incremental) |
| 45 | |
| 46 | - Update `pom.xml` to JSF 2.3 dependency. |
| 47 | - Replace `@ManagedBean` + `@javax.faces.bean.*Scoped` with `@Named` + `@javax.enterprise.context.*Scoped`. |
| 48 | - `@ViewScoped`: replace `javax.faces.bean.ViewScoped` with `javax.faces.view.ViewScoped`. |
| 49 | - Ensure `beans.xml` exists in `WEB-INF/` with `bean-discovery-mode="all"` or `"annotated"`. |
| 50 | - Replace `@javax.faces.bean.ManagedProperty` on managed beans with `@Inject`. |
| 51 | - Replace `@javax.faces.bean.ManagedProperty` on unmanaged variables with `@javax.faces.annotation.ManagedProperty`. |
| 52 | - FacesServlet: ensure URL pattern is `*.xhtml`; remove legacy `*.jsf`, `*.faces`, `/faces/*` mappings. |
| 53 | - Update `faces-config.xml` version to `2.3`. |
| 54 | ```xml |
| 55 | <faces-config |
| 56 | xmlns="https://xmlns.jcp.org/xml/ns/javaee" |
| 57 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 58 | xsi:schemaLocation="https://xmlns.jcp.org/xml/ns/javaee https://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" |
| 59 | version="2.3" |
| 60 | > |
| 61 | ``` |
| 62 | - Update `*.taglib.xml` version to `2.3`. |
| 63 | ```xml |
| 64 | <facelet-taglib |
| 65 | xmlns="https://xmlns.jcp.org/xml/ns/javaee" |
| 66 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 67 | xsi:schemaLocation="https://xmlns.jcp.org/xml/ns/javaee https://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_3.xsd" |
| 68 | version="2.3" |
| 69 | > |
| 70 | ``` |
| 71 | - Update XML namespaces from `java.sun.com` to `xmlns.jcp.org` (if on JSF 2.2+). |
| 72 | - Use HTML5 doctype `<!DOCTYPE html>` (if on JSF 2.2+). |
| 73 | - Review for new 2.3 features to adopt: https://arjan-tijms.omnifaces.org/p/jsf-23.html |
| 74 | |
| 75 | ### JSF 2.3 → Faces 3.0 (Jakarta EE 9, names |