当前位置: 动力学知识库 > 问答 > 编程问答 >

jsf 2.2 - Is it ok to package my webapp as JAR and put web resources under META-INF/resources?

问题描述:

I have several JSF projects (built by maven) which depend on a project with common web resources.

I have two possibilities:

a) All projects have packaging type war and the maven-war-plugin will merge everything into one war (overlay).

b) My project with common web resources is packaged as war and all the other projects become jar artifacts. These projects have ALL their web resources under src/main/resources/META-INF/resources (servlet 3 API) and no longer have a src/main/webapp folder.

Are there disadvantages with this approach?

I think, b) shows great modularity but the "new" directory structure could confuse the developers.

网友答案:

With a) you won't be able to export and distribute the common web project as a JAR (like as PrimeFaces, OmniFaces, RichFaces, etc all do). With b) you will be.

This is indeed just the recommended structure for servlet based web fragment projects (see also chapter 8.2 of Servlet 3.0 specification). It may indeed potentially confuse badly educated developers, but this is a non-technical issue, it's merely an education issue. Just take this into account when introducing new devs to the project (e.g. cover it in the interview and/or document it in the internal project manual).

See also:

  • Structure for multiple JSF projects with shared code
分享给朋友:
您可能感兴趣的文章:
随机阅读: