3

I'm trying to upgrade from JSF 2.2 to 2.4 in Netbeans 11.0.

I downloaded the binaries and added it as a new library:

Global Libraries

But when I look into the properties of my project, I still see the old JSF versions 1.2 and 2.2:

Project Properties


Is adding it as a Maven dependency the only way to upgrade? I wanted to upgrade it globally, for all (future) projects.
I'm using Java EE 8 with Payara Server 5.192.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181

1 Answers1

12

JSF 2.4 does not exist as an official API at all. Do not use it. Currently latest official version is 2.3 and the next one will be 3.0 which will be released as part of Jakarta EE 9 (which is essentially exactly the same as 2.3, but then with the package renamed from javax.faces to jakarta.faces).

See also the blog article Do not use org.glassfish Mojarra 2.4.0! written by yours truly.

No, JSF 2.4 is not there. Technically speaking, Mojarra 2.4.0 represents the latest state of the master branch as it was during the transfer from Oracle to Eclipse. That transfer took place when JSF 2.3 specification was already released and JSF 2.4 specification has still to be started yet. JSF 2.4 is far from being a beta, let alone a reasonable snapshot. And yet there is a Mojarra 2.4.0 in Maven instead of e.g. a Mojarra 2.4.0-M1. As per the agreement between Oracle and Eclipse, it was necessary to release the latest work on Mojarra under Oracle's umbrella into Maven Central before the transfer to Eclipse was completed, and this had to be done without making any code modifications, even pom.xml version changes are not allowed and thus the version couldn't be modified. And later Eclipse will do the same after the transfer is completed so that the integrity can be validated by the public. Using version "2.4.0" is indeed way too confusing for the public, because does actually not at all represent a real "2.4.0" version, but it is what it is.

In other words, you should not use it. Mojarra 2.4.0 is basically somewhere in between Mojarra 2.3.3 and 2.3.4. A few days later, Mojarra 2.3.4 was released. Use this instead.

Or, if there's already a newer 2.3.x version available, obviously use that instead.

As to your specific problem with Netbeans, you need to upgrade it to see "JSF 2.3" as an option in its built-in dropdown. Alternatively you can also just ignore it and write JSF 2.3 targeted code yourself instead of letting the IDE autogenerate it. That's basically what that "JSF 2.3" option is doing. Autogenerating the suitable JSF 2.3 faces-config.xml file and such. But you as a programmer of course can easily write code yourself based on official documentation.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555