Create and Run ZK Application with Maven Artifacts"

From Documentation
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{ZKInstallationGuidePageHeader}}
 
{{ZKInstallationGuidePageHeader}}
  
 +
{{Deprecated
 +
|url=[[ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven]]
 +
|}}
 +
 +
__TOC__
 +
 +
 +
If you are first to Maven, please refer to [[ZK Installation Guide/Setting up IDE/Maven/Create and Run ZK Application with Maven Archetype|Create and Run ZK Application with Maven Archetype]] because it is easy to follow. This article is more helpful for users who already have a Maven project and/or want to handle some of the configuration files manually.
 +
 +
=How to create ZK Maven web project=
 
[[File:MavenProject.png|frame|ZK Maven Project Hierarchy]]
 
[[File:MavenProject.png|frame|ZK Maven Project Hierarchy]]
=How to create ZK Maven web project=
 
 
== Create Project of Maven==
 
== Create Project of Maven==
 
*'''[File]''' -> '''[New]''' -> '''[Other]''' --> '''[Maven Project]'''
 
*'''[File]''' -> '''[New]''' -> '''[Other]''' --> '''[Maven Project]'''
Line 9: Line 18:
 
*:[[File:ZK_Installation_Guide_Maven_step2.png]]
 
*:[[File:ZK_Installation_Guide_Maven_step2.png]]
 
*Fill the first 4 field '''(you can change them later)''' --> Click '''[Finish]'''
 
*Fill the first 4 field '''(you can change them later)''' --> Click '''[Finish]'''
 +
*:''Group Id'' is usually the package name but it could be anything you prefer. Here we use <tt>org.zkoss</tt>, but it is better to use your own.
 +
*:''Arifact Id'' is your project's ID.
 +
*:''Version'' is your project's version.
 
*:[[File:ZK_Installation_Guide_Maven_step3.png]]
 
*:[[File:ZK_Installation_Guide_Maven_step3.png]]
  
Line 14: Line 26:
 
#Create new folder under '''/src/main/''' named webapp
 
#Create new folder under '''/src/main/''' named webapp
 
#Right Click on your Maven Project -> Choose '''Properties''' -> Choose '''Project Facets''' -> Check '''Dynamic Web Module'''
 
#Right Click on your Maven Project -> Choose '''Properties''' -> Choose '''Project Facets''' -> Check '''Dynamic Web Module'''
*: Note: if it showing '''Covert facet from...''', simply click it to enable facet.
+
#: Note: if it showing '''Covert facet from...''', simply click it to enable facet.
*:[[File:ZK_Installation_Guide_Maven_web1.png]]
+
#:[[File:ZK_Installation_Guide_Maven_web1.png]]
 
#Click '''Further configuration available'''' --> input the ''Context Root'' and ''Content Directory'' --> Check '''Generate web.xml deployment descriptor'''
 
#Click '''Further configuration available'''' --> input the ''Context Root'' and ''Content Directory'' --> Check '''Generate web.xml deployment descriptor'''
*:[[File:ZK_Installation_Guide_Maven_web2.png]]
+
#:[[File:ZK_Installation_Guide_Maven_web2.png]]
  
 
== Enable Dependency and Web Project configuration ==
 
== Enable Dependency and Web Project configuration ==
Line 27: Line 39:
 
*Overwrite the content of '''pom.xml''' with [[ZK Installation Guide/Setting up IDE/Maven/Use ZK Maven Repository#Sample_of_pom.xml | Sample of pom.xml]]
 
*Overwrite the content of '''pom.xml''' with [[ZK Installation Guide/Setting up IDE/Maven/Use ZK Maven Repository#Sample_of_pom.xml | Sample of pom.xml]]
  
=How to run Maven project on Run-Jetty-Run=
+
=How to run Maven project on Run-Jetty-Run (Optional) =
 +
Notice that [http://code.google.com/p/run-jetty-run/ Run-Jetty-Run] is optional. The speed of deployment is much faster, but the server is [http://jetty.codehaus.org/jetty/ Jetty] embedded in Run-Jetty-Run. If you prefer to use your own server, you could skip this step.
 +
 
 
#Create new zul file '''index.zul''' <ref>[[ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and ZK Studio#Create_a_new_ZUL_file]]</ref> under '''/src/main/webapp'''
 
#Create new zul file '''index.zul''' <ref>[[ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and ZK Studio#Create_a_new_ZUL_file]]</ref> under '''/src/main/webapp'''
 
#Goto '''Run Configurations'''
 
#Goto '''Run Configurations'''

Latest revision as of 04:44, 22 June 2012


DocumentationZK Installation GuideSetting up IDEMavenUse ZK Maven ArtifactsCreate and Run ZK Application with Maven Artifacts
Create and Run ZK Application with Maven Artifacts



Stop.png This article is out of date, please refer to ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and Maven for more up to date information.


If you are first to Maven, please refer to Create and Run ZK Application with Maven Archetype because it is easy to follow. This article is more helpful for users who already have a Maven project and/or want to handle some of the configuration files manually.

How to create ZK Maven web project

ZK Maven Project Hierarchy

Create Project of Maven

  • [File] -> [New] -> [Other] --> [Maven Project]
    ZK Installation Guide Maven step1.png
  • Check Create a simple Project
    ZK Installation Guide Maven step2.png
  • Fill the first 4 field (you can change them later) --> Click [Finish]
    Group Id is usually the package name but it could be anything you prefer. Here we use org.zkoss, but it is better to use your own.
    Arifact Id is your project's ID.
    Version is your project's version.
    ZK Installation Guide Maven step3.png

Add WTP Support (Project Facet)

  1. Create new folder under /src/main/ named webapp
  2. Right Click on your Maven Project -> Choose Properties -> Choose Project Facets -> Check Dynamic Web Module
    Note: if it showing Covert facet from..., simply click it to enable facet.
    ZK Installation Guide Maven web1.png
  3. Click Further configuration available' --> input the Context Root and Content Directory --> Check Generate web.xml deployment descriptor
    ZK Installation Guide Maven web2.png

Enable Dependency and Web Project configuration

web.xml

pom.xml

How to run Maven project on Run-Jetty-Run (Optional)

Notice that Run-Jetty-Run is optional. The speed of deployment is much faster, but the server is Jetty embedded in Run-Jetty-Run. If you prefer to use your own server, you could skip this step.

  1. Create new zul file index.zul [1] under /src/main/webapp
  2. Goto Run Configurations
    ZK Installation Guide maven run1.png
  3. Double click on Jetty Webapp
    • It will auto fill Project / Port / Context / WebApp Dir
    ZK Installation Guide maven run2.png
  4. Click Run and browse http://127.0.0.1:8080/TestMavenWebProject/