This is the first milestone release of OmniFaces 4.0, which is the first version developed specifically for JSF 3.0 from Jakarta EE 9 which is currently scheduled to be released at September 2020! OmniFaces 4.x is NOT backwards compatible with earlier Java EE / JSF versions because of the migration of the javax.*
package to jakarta.*
package.
Noted should be that Jakarta EE 9 initially went for Java 11 as minimum Java version, as can be seen in pom.xml of RC1, but this was unfortunately since RC2 switched back to Java 1.8 due to time constraints. Hence OmniFaces 4.0 is also still at Java 1.8.
The integration tests currently run successfully on GlassFish 6.0.0.M1.
Breaking changes:
- Obviously, the migration from
javax.*
package tojakarta.*
package. E.g.javax.faces.context.FacesContext
is now available atjakarta.faces.context.FacesContext
. This is however a general change in Jakarta EE itself. Jakarta EE 8 did still use thejavax.*
package, but Jakarta EE 9 uses now its ownjakarta.*
package. OmniFaces own packageorg.omnifaces.*
is still the same as it is. The date beansUPDATE: as per the upcoming 4.0-M2 these will continue supporting and#{now}
have been migrated from#{startup}
java.util.Date
tojava.time.Instant
. This means that e.g. does now not work anymore as the#{now.time}
java.time.Instant
does not have agetTime()
method. EL 4.0 will throw the following exception:
Sorry about that, but it was high time to migrate to the much betterjakarta.el.ELException: /test.xhtml: The class 'java.time.Instant' does not have the property 'time'.
java.time
API! You need to modify your JSF files to catch up this. Use e.g. ,#{now.epochSecond}
, or#{now.nano}
instead.#{now.toEpochMilli()}
format! And additionally these will offer#{now.time}
and#{now.instant}
properties to give you concrete instances of#{now.zonedDateTime}
java.time.Instant
andjava.time.ZonedDateTime
.- The
<o:form includeViewParams="true">
which was deprecated since 3.0 has now been removed because this is already the default behavior. - The
WebXml.INSTANCE
andFacesConfigXml.INSTANCE
which were deprecated since 3.1 have now been removed. UseWebXml.instance()
andFacesConfigXml.instance()
instead. This was done because they can then be@Inject
'ed in a CDI bean. - The script
omnifaces:fixviewstate.js
which was deprecated since 3.0 has now been removed. This script is unnecessary since JSF 2.2 as it was fixed over there.
No new things are added, so the existing features are basically the same as with the current 3.7.1 version. JSF 3.0 itself is technically also basically the same as JSF 2.3, except for the change of the package from javax.faces.*
to jakarta.faces.*
. In other words, it has just been 'jakartified' ;)
Also note that the showcase still runs 3.7.1 (for now). Once WildFly comes with a final JEE9 version, it'll be updated over there as well.
Installation
Non-Maven users: download OmniFaces 4.0-M1 JAR and drop it in /WEB-INF/lib
the usual way, replacing the older version if any.
Maven users: use <version>4.0-M1</version>
.
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>4.0-M1</version>
</dependency>
If you have found any issues or comments related to OmniFaces 4.0, please by all means report an issue.
Migration of your project from Java EE 8 / Jakarta EE 8 to Jakarta EE 9
Use this dependency (note: keep an eye on newer RC/M versions and bump accordingly):
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.0.0-RC2</version>
<scope>provided</scope>
</dependency>
Then it's really basically a matter of performing a find&replace of the literal string "javax.
" to "jakarta.
" throughout the entire project! Perhaps a few things will not compile because they are still javax.*
, but it's a matter of renaming them back, which you can then do a bit more specific. For example, javax.xml.*
and javax.sql.*
are still in Java SE. You should then find&replace e.g. the "jakarta.xml.
" back to "javax.xml.
". Oh, don't forget to rename the files in META-INF/services
, if any ;)
No comments:
Post a Comment