1

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.

Ginkgochris
  • 427
  • 4
  • 24

1 Answers1

0

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:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Yes that's true. I wonder how we solved this packaging problem before servlet 3 spec existed. Can the Maven Assembly plugin help me here as an option c)? – Ginkgochris Jun 30 '14 at 07:58
  • It's the same. Before Servlet 3 it was only not possible to auto-register artifacts from the JAR on. Everything had to end up in WAR's `web.xml`, manually. Since Servlet 3 it is possible using `web-fragment.xml` and new `@WebListener`, `@WebServlet`, `@WebFilter`, etc annotations in JAR. That's basically the only difference. – BalusC Jun 30 '14 at 08:00