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