• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best practise for Maven for Web Project

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
~Hi,
In your standard Web Application, you have WebContent (HTML, .CSS, javascript and JSPs) and Java source files.

Is it best practise in maven to have one pom for your entire web project (webcontent + Java Source files) or to have one pom for your web content and then one for your javasource files.
Your Java source files then get packaged to a jar and your WebContent is packaged as a War which depends on the Java Source Files packaged as jar.

Many thanks.

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I has always seen the servlets and their helper classes appearing in the same projects with the static web content. Thus the classes end up in WEB-INF/classes. In a way this makes more sense because usually the Java sources and the static content are closely related. If the Java classes were packaged in a separate JAR file, one would usually assume that that JAR could be used in multiple projects, which in this instances is not the case.

Anyway, that is my 2 cents.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless I'm mistaken, you're considering a scenario where the static content of a webapp is being packaged and deployed separately from the dynamic stuff. JSPs, BTW are not static content - they're compiled into dynamic components, and therefore cannot be effectively deployed in a static content server.

There once was a practical performance reason for separating static and active services in J2EE, but that was long, long ago. Modern-day servers such as Tomcat can serve up CSS and HTML just as efficiently as Apache can, so there's no real reason to complicate matters by creating a separate static content bundle.

If you do choose to separate the 2, however, the "correct" way would be to make each package be a separate Maven project, since the Maven rule is 1 product output per project.
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic