gpt4 book ai didi

tomcat - Maven tomcat :run goal and jsf annotation based component/converter/validator scanning

转载 作者:行者123 更新时间:2023-11-28 21:47:21 24 4
gpt4 key购买 nike

我正在开发一个 JSF 2.0 应用程序 (Mojarra+Primefaces) 并使用 maven 构建环境。在我使用 faces-config.xml 文件注册我的自定义转换器和验证器之前,到目前为止一切顺利。然后我看到了 JSF 2.0 的一些语法糖——基于注释的配置方法。现在我想使用它,而不是 xml 配置文件。一个问题是 Mojarra 没有扫描我的注释类。我发现我需要把 <faces-config ... metadata-complete="false">属性为假。现在它可以工作,但前提是我用 mvn tomcat:run-war 启动我的应用程序目标而不是 mvn tomcat:run 动态项目,开发起来更舒服。 JSP 2.0 的规范说:

If the element in the WEB-INF/faces-config.xml file contains metadata-complete attribute whose value is "true", the implementation must not perform annotation scanning on any classes except for those classes provided by the implementation itself. Otherwise, continue as follows.

If the runtime discovers a conflict between an entry in the Application Configuration Resources and an annotation, the entry in the Application Configuration Resources takes precedence. All classes in WEB-INF/classes must be scanned.

For every jar in the application's WEB-INF/lib directory, if the jar contains a "META-INF/faces-config.xml" file or a file that matches the regular expression ".*.faces-config.xml" (even an empty one), all classes in that jar must be scanned.

但是它没有说明在 maven 构建环境中运行的动态项目:)!有人能解决这个问题吗?

干杯,

凯文

最佳答案

我也有这个问题,但发现添加 war:inplace 目标使它对我有用。即使用

mvn clean war:inplace tomcat:run

而不仅仅是“tomcat:run”,它应该可以正常工作。

关于tomcat - Maven tomcat :run goal and jsf annotation based component/converter/validator scanning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4409148/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com