如何在 WildFly 上安装 JSF 2.3 (javax.faces.jar) 的一个 jar 变体 [英] How to install one jar variant of JSF 2.3 (javax.faces.jar) on WildFly
问题描述
我想在我的应用程序上使用 JSF 2.3,但 WildFly 使用 2.2 的 JAR 变体.
I want to use the JSF 2.3 on my application, but WildFly uses the 2 JAR variant for 2.2.
Oracle 在这里说https://javaserverfaces.java.net/2.3/download.html 不会发布 2.3 2 JAR 变体.
Oracle said here https://javaserverfaces.java.net/2.3/download.html that won't release a 2.3 2 JAR variant.
推荐答案
手动流程如下:
使用 ZIP 工具提取
javax.faces.jar
.您将获得 3 个文件夹com
、javax
、META-INF
(注意:在某些版本中,您将还看到根目录中有一个jsf.js
文件,但这是一个错误,你应该忽略它,它已经位于META-INF/resources/javax.faces
)
Extract
javax.faces.jar
with a ZIP tool. You'll get 3 folderscom
,javax
,META-INF
(NOTE: in some versions you'll also see ajsf.js
file in the root, but this is a mistake, you should ignore it, it's already located inMETA-INF/resources/javax.faces
)
使用 ZIP 工具将 com
和 META-INF
文件夹打包到 jsf-impl.jar
中.
Pack com
and META-INF
folders into jsf-impl.jar
with a ZIP tool.
然后,删除META-INF
除了的MANIFEST.MF
中的所有文件/子文件夹.
Then, delete all files/subfolders in META-INF
except of MANIFEST.MF
.
使用 ZIP 工具将 javax
和 META-INF
文件夹打包到 jsf-api.jar
中.
Pack javax
and META-INF
folders into jsf-api.jar
with a ZIP tool.
继续使用这些 JAR:升级 JSF/Mojarra在 JBoss AS/EAP/WildFly 中.
Continue here with those JARs: Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly.
对于感兴趣的人,JBoss AS 和 WildFly 在内部对基于 Java EE 的 API 和 impl 文件进行了模块化分离.仍然需要分离的 JAR 文件 jsf-api.jar
和 jsf-impl.jar
.原因并不是真正的技术,而只是强制开发人员针对正确的库进行编程的额外服务.在编译期间仅公开 API 模块(通常,通过 IDE 集成插件将它们添加到构建路径").这应该避免初学者意外地找到、导入和使用实现类,例如 com.sun.faces.*
包中的实现类.
For the interested, JBoss AS and WildFly has internally a modular separation of Java EE based API and impl files. The separated JAR files jsf-api.jar
and jsf-impl.jar
are still needed. The reason is not really technical, but just an extra service to force developers programming against the right libraries. Only the API modules are exposed during compile time (usually, via the IDE-integrated plugin which adds them to "build path"). This should avoid starters accidentally finding, importing and using implementation classes such as those in com.sun.faces.*
package.
从 1.x 版开始,JSF 实现 Mojarra 就由两个 JAR 文件组成:jsf-api.jar
和 jsf-impl.jar
.API JAR 包含javax.faces.*
类,实现JAR 包含com.sun.faces.*
类.由于构建系统的变化符合 Java EE Maven 规则,API 和实现类都合并到一个 javax.faces.jar
文件中,另见 issue 2028(从 2011 年 12 月的 Mojarra 2.1.6 开始).从 Mojarra 2.3 开始,不再构建分离的 JAR 文件.
Already since version 1.x, the JSF implementation Mojarra was composed of two JAR files: jsf-api.jar
and jsf-impl.jar
. The API JAR contained the javax.faces.*
classes and the implementation JAR contained the com.sun.faces.*
classes. Since the change of the build system conform Java EE Maven rules, both the API and implementation classes were merged into a single javax.faces.jar
file, see also issue 2028 (started with Mojarra 2.1.6 at Dec 2011). Since Mojarra 2.3, the separated JAR files are not built anymore.
这篇关于如何在 WildFly 上安装 JSF 2.3 (javax.faces.jar) 的一个 jar 变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!