You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2006/01/03 13:36:12 UTC
[Myfaces Wiki] Update of "Myfaces Eclipse Setup" by hari sujathan
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by hari sujathan:
http://wiki.apache.org/myfaces/Myfaces_Eclipse_Setup
New page:
##language:en
Myfaces application can be configured in eclipse and launched using tomcat/jetty servlet container.
Lets assume a general web application directory structure:
{{{
<root>
+---lib
+---persistence
| +---src
| +---java
+---service
| +---src
| +---java
+---web
+-----src
| +---java
+-----webapp
+---WEB-INF
| +---classes
| +---lib
| +---web.xml
| +---faces-config.xml
+---<view pages>
}}}
The <root>/lib folder contains Myfaces jars (Let <root> folder be ''c:\workspace\myproject''). Its may be a good idea to download all latest commons jars and put in a subdirectory under lib (eg: latest version of commons-logging.jar will be used by Myfaces as well as hibernate, avoiding maintainence of different versions).
Install the following:
* j2sdk 1.5
* eclipse sdk 3.1 (c:\eclipse)
* tomcat 5.x if you want to use tomcat(c:\applications\Tomcat5.x)
* jetty 5.1 if you want to use jetty(c:\applications\jetty5.1)
=== Following steps are common whether configuring for tomcat or jetty ===
* create a new java project in eclipse.In project properties do add all the source code in the source path.
* make the "destination path" as <root>/web/webapp/WEB-INF/classes in project properties.
* create a new user library and add all jars under <root>/lib folder to it recursively.
* Now the project should be compiling without errors and all class files should get generated under <root>/web/webapp/WEB-INF/classes.
----
== Configuring in Tomcat ==
Either of the two eclipseplugins for tomcat need to be installed: "sysdeo" and "wtp tomcat plugin". We will cover Sysdeo plugin as it is easy to configure(wtp1.0 tomcat plugin enforces a predefined directory structure).
* unzip sysdeo plugin into c:\eclipse\plugins directory and restart eclipse.
* go to windows --> preferences --> Tomcat
* select the tomcat version and enter the Tomcat home (c:\applications\Tomcat5.x). Click OK.
* Click on the start tomcat icon in the eclipse toolbar to startup tomcat. ( make sure its running)
* Now copy all jars under <root>/lib to c:\applications\Tomcat5.x\common\lib. directory structure under <root>\lib needs to be flattened up when copying to tamcat's common lib folder
* create a new myproject.xml file in C:\applications\Tomcat5.x\conf\Catalina\localhost directory. Following needs to be entered:
{{{
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="${catalina.home}/../../workspace/myproject/web/webapp" path="/myproject">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_myproject_log." suffix=".txt"
timestamp="true"/>
</Context>
}}}
* restart tomcat from eclipse by pressing the restart icon.
* localhost:8080/myproject/index.faces shows welcome page. {OK}
----
== Configuring in Jetty ==
* Install JettyLauncher plugin from http://jettylauncher.sourceforge.net/updates and restart eclipse.
* Right click on project --> Run as --> Run
* Select "Jetty Web" on the left hand pane, and click new button at the bottom left hand corner.
* In the screen that shows up on right hand pane, enter following:
1. jetty home: {{{c:\applications\jetty5.1}}}
2. webapp root dir: {{{web/webapp}}}
3. contextname: {{{myproject}}}
4. http host: {{{localhost}}}
* Click on "Apply". Click "Run".
* localhost:8080/myproject/index.faces shows welcome page. {OK}
----