How to create Dynamic Web project in Eclipse with Maven and ZKoss Support

This document intends to explain how to create a Dynamic web project in Eclipse and then how to add Maven and ZKoss support in it. These days almost all Java web projects require Apache Maven Support. A Dynamic Web project follows a folder structure where all the web related files goes into WebContent folder. Whereas in Maven project all web related files go into webapps folder. It becomes difficult for the new developer to manage both of them in one project.

I have listed down simple steps to create a Dynamic web project in Eclipse with Maven and Zkoss support.

Terms

Apache Maven – is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

ZKoss – ZKoss is a highly productive open source Java framework for building amazing enterprise web and mobile applications.

Prerequisite –

Install ZKoss plugin in Eclipse – http://books.zkoss.org/wiki/ZK_Studio_Essentials/Installation

Install Maven plugin in Eclipse – http://marketplace.eclipse.org/content/maven-integration-eclipse?mpc=true&mpc_state=

Tomcat (any other) webserver is added to deploy web application within Eclipse.

Steps –

  1. Create a new maven project in Eclipse.
  2. Click on Create a simple project(Skip archetype selection)
  3. Add groupId and artifactId. ArtifactId is the name of the project. Also select war for the packaging option from the drop down. Create project.
  4. You will see src->main->webapp folder. If not something must be wrong.
  5. Go to project properties, select project Facets and select Dynamic Web project and ZK from the list and then apply.
  6. Move contents of target/WebContent folder to the src/main/webapps folder and Delete the WebContents folder.
  7. Right click on the project, run as maven install. Project should get build without any error.
  8. Then right click on project and go to properties, Go to Deployment Assembly. Delete the WebContent entry.
  9. Add new folder and select webapps folder. Also add the folder – target/<ProjectName-Version>. Apply and OK
  10. Run Maven install and then deploy application by running project on the server. You will see following screen.

Note: – In case you get page not found exception, please recheck your deployment Assembly setting from project properties and verify that target folder is set properly.

4 thoughts on “How to create Dynamic Web project in Eclipse with Maven and ZKoss Support

  1. Nice pictorial solution of a very common problem scenario!

    We usually face difficulties in project setup, specially the very first time we create a web project with maven and zkoss. But rarely we care about noting down the steps & tend to copy-paste the entire project structure next time onward. Eventually, we mess up the directory structure & go back to square one! This blog will help many of us come out of this vicious cycle.

    Thanks for the post once again :)

Leave a Reply

Your email address will not be published. Required fields are marked *


four + = 13

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>