Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-tapestry Wiki" 
for change notification.

The following page has been changed by MatGessel:
http://wiki.apache.org/jakarta-tapestry/HowToSetupEclipseWtp

The comment on the change is:
almost done

------------------------------------------------------------------------------
- == Benefits to using Web Tools Platform ==
+ [[TableOfContents]]
  
-  * Automatically reloads affected context when Java source files change
-  * Easy to use Eclipse debugger
+ == Purpose of this document ==
+ Once setup correctly WTP is easy to use. However it can be a real pain to 
setup a new Tapestry project in WTP. This document exists to so that new users 
can setup WTP without hours of troubleshooting and experienced users don't 
forget anything. 
+ 
+ == Benefits to using the Eclipse Web Tools Platform for Tapestry development 
==
+ 
+  * No Ant scripts needed to build and deploy
-  * Start, stop & restart web server within Eclipse
+  * Start, stop & restart the web server within Eclipse
+  * Automatic, on-the-fly deployment of all classes, libraries and resources
+  * Server context reloads automatically when Java source files change (often 
faster than a full server restart)
+  * Tomcat installation is not modified
-  * Auto-completion and validation in XML editors of elements and attribute 
names (i.e. HTML templates, application, page & component specifications)
+  * Content assist and validation in XML editors of elements and attribute 
names (i.e. HTML templates, application, page & component specifications).      
   
+  * Debugger ''just works'' for deployed code
   * Works with Tapestry 4 (Spindle was not available at time of writing)
+ 
+ ''Note: for some reason content assist does not work with the application 
specification. It is validated however.''
+ 
+ ''Note: projects are deployed as part of the build process. You will have to 
manually initiate a build if you prefer to have '''Project > Build 
Automatically''' unchecked.''
  
  == Tested Configuration ==
  
@@ -14, +26 @@

  
   * Tapestry 4.0
   * JDK 1.5.0
+  * Ant 1.6.3
   * Tomcat 5.0
   * Windows XP
   * Eclipse 3.1.1
   * Web Tools Platform 1.0
  
+ === Prerequisites ===
- == Steps ==
- === 1. Installation ===
   * Install JDK 1.5.0 http://java.sun.com/j2se/1.5.0/download.jsp
+  * Install Ant
   * Install Tomcat 5 http://tomcat.apache.org/download-55.cgi
   * Install and build Tapestry 4.0. See BuildingTapestry
   * Install Eclipse and Web Tools Platform. The easiest way is to grab the 
All-in-one download. This contains Eclipse, WTP, EMF, GEF & JEM, all of which 
you need to run WTP. 
http://download.eclipse.org/webtools/downloads/drops/R-1.0-200512210855/
  
+ == Steps ==
- === 2. Launch Eclipse ===
+ === 1. Launch Eclipse ===
+  * Launch Eclipse
- Close the Welcome tab (you can get to it later by Help > Welcome
+  * Close the '''Welcome''' tab (you can get to it later by '''Help > 
Welcome''')
  
- === 3. Define JDK ===
+ === 2. Define the JDK ===
- Eclipse will launch with your machine's default JRE. Tomcat typically needs 
to launch from the JDK (not sure if this is necessary for Tapestry). 
+ Eclipse will launch with your machine's default JRE. Tomcat typically needs 
to launch from the JDK (not sure if this is necessary for Tapestry 
development). 
  
- '''Window''' > '''Preferences...'''
+  * '''Window''' > '''Preferences...'''
+  * Click '''Java''' > '''Installed JREs''' 
+  * Add JDK 1.5 if necessary ('''not''' JRE 1.5)
  
- Click '''Java''' > '''Installed JREs''' 
+ === 3. Associate Tapestry file extentions with the XML editor ===
+  * In '''Preferences''' go to '''General''' > '''Content Types'''
+  * Select add `.project`, `.page`, `.jwc` and `.library` extensions to the 
'''Text''' > '''XML''' node
+ attachment:ContentTypes.gif
  
- Add JDK 1.5 if necessary ('''not''' JRE 1.5)
- 
- === 4. Associate Tapestry file extentions with XML editor ===
- In '''Preferences''' go to '''General''' > '''Content Types'''
- 
- Select add `.project`, `.page`, `.jwc` and `.library` extensions to the 
'''Text''' > '''XML''' node
- 
- http://www.asquare.net/images/WTPHowTo/ContentTypes.gif
- 
- === 5. Define a Server Runtime ===
+ === 4. Define a Server Runtime ===
  This tells Eclipse where Tomcat is installed. 
  
- '''Window''' > '''Preferences...'''
+  * '''Window''' > '''Preferences...'''
+  * Open the '''Server ''' preference and select '''Installed Runtime'''
+  * Click '''Add...''' 
+  * Select '''Apache''' > '''Apache Tomcat v5.0''' and click '''Next'''
+  * Browse to and select your Tomcat root directory e.g. ''C:\Program 
Files\Apache Software Foundation\Tomcat 5.0''
+  * Select JDK 1.5
+ attachment:TomcatServerRuntime.gif
+  * Click '''Finish'''
+  * Click '''OK''' to close the Preferences dialog
  
- Open the '''Server ''' preference and select '''Installed Runtime'''
- 
- Click '''Add...''' 
- 
- Select '''Apache''' > '''Apache Tomcat v5.0''' and click '''Next'''
- 
- Browse to and select your Tomcat root directory e.g. ''C:\Program 
Files\Apache Software Foundation\Tomcat 5.0''
- 
- Select JDK 1.5
- 
- http://www.asquare.net/images/WTPHowTo/TomcatServerRuntime.gif
- 
- Click '''Finish'''
- 
- Click '''OK''' to close the Preferences dialog
- 
- === 6. Define a Server Instance ===
+ === 5. Define a Server Instance ===
- '''Window''' > '''Show View''' > '''Other'''
+  * '''Window''' > '''Show View''' > '''Other'''
- 
- Open the '''Server''' > '''Servers''' view
+  * Open the '''Server''' > '''Servers''' view
- 
- Right click in the '''Servers''' view and select '''New > Server...'''
+  * Right click in the '''Servers''' view and select '''New > Server...'''
+ attachment:NewServer.gif
- 
- http://www.asquare.net/images/WTPHowTo/NewServer.gif
- 
- Select '''Apache > Tomcat v5.0 Server'''
+  * Select '''Apache > Tomcat v5.0 Server'''
- 
- Select the server runtime you created previously
+  * Select the server runtime you created previously
+ attachment:NewServer2.gif
- 
- http://www.asquare.net/images/WTPHowTo/NewServer2.gif
- 
- And click '''Finish'''
+  * And click '''Finish'''
- 
- You should now have a server in the '''Servers''' view
+  * You should now have a server in the '''Servers''' view
  
  ''A side-effect of creating a Server Configuration is a new '''Servers''' 
project will be created.''
  
- http://www.asquare.net/images/WTPHowTo/ServersProject.gif
+ attachment:ServersProject.gif
  
  ''It also creates a new '''Run''' configuration. You can ignore this, but 
don't delete it--it is used to save VM arguments.''
  
- === 7. Disable Caching of Tapestry files ===
+ === 6. Disable Caching of Tapestry files ===
  ''WTP does not automatically reload the context when page specifications and 
HTML templates are changed. If you set the Tapestry flag to disable caching you 
don’t need to restart the context to see changes.'' See 
http://jakarta.apache.org/tapestry/UsersGuide/configuration.html#N10106
  
- Double-click the server insance you created previously to open it in the 
editor view. 
+  * Double-click the server insance you created previously to open it in the 
editor view. 
+  * '''General > Open launch configuration'''
+  * Select the '''Arguments''' tab
+  * Add `-Dorg.apache.tapestry.disable-caching=true` to the '''VM arguments'''
+  * Add `-enableassertions` if you use assertions
+ attachment:ServerArguments.gif
  
- '''General > Open launch configuration'''
+ === 7. Create a Dynamic Web Project ===
+ The Dynamic Web Project is a part of WTP. It adds automatic deployment 
support. 
+  * '''File > New > Project'''
+  * '''Web > Dynamic Web Project'''
+ attachment:NewDynamicWebProject.gif
+  * Use defaults for rest of wizard and click ''Finish''
+  * When the project is created you will be asked whether you want to open the 
''J2EE'' perspective. Click '''No'''. 
  
- Select the '''Arguments''' tab
+ ''Note: You can open the '''J2EE''' perspective later via '''Window > Open 
Perspective > Other...'''''
  
- Add `-Dorg.apache.tapestry.disable-caching=true` to the '''VM arguments'''
+ === 8. Add Tapestry libraries to the project ===
+ ''Note: I was unable to employ the '''user library''' approach for adding 
Tapestry libraries to the project. Tapestry was not loaded at runtime''
  
- Add `-enableassertions` if you use assertions
+  * Go to the `lib` directory of your Tapestry installation (e.g. 
`D:\tools\tapestry-4.0\ext-package\lib`)
+  * Copy all the jars into `WebContent/WEB-INF/lib`. You can simply drag the 
jars to the `lib` folder in Eclipse or do a file system copy (do a '''File > 
Refresh''' if necessary). 
+ attachment:WebAppLibraries.gif
  
- http://www.asquare.net/images/WTPHowTo/ServerArguments.gif
+ WTP automatically adds the libraries to the build path and publishes them for 
Tomcat to use. 
  
- === 8. Create a Dynamic Web Project ===
- '''File > New > Project'''
+ === 9. Setup a Skeleton Site ===
+ Unfortunately we don't have Spindle to create the skeleton files for us. 
Below are the files used in this How-To. 
  
- '''Web > Dynamic Web Project'''
+  * Download and copy these files to the `WebContent/WEB-INF/` directory
+ attachment:web.xml
  
- http://www.asquare.net/images/WTPHowTo/NewDynamicWebProject.gif
+ attachment:TapestryTest.application
  
- Use defaults for rest of wizard and click ''Finish''
+ attachment:Home.html
  
+ attachment:Home.page
- When the project is created you will be asked whether you want to open the 
''J2EE'' perspective. Click ''No''. 
- ''Note: You can open the '''J2EE''' perspective later via '''Window > Open 
Perspective > Other...'''
  
- = TODO =
+  * Download and copy this Java file to the `src` directory
+ attachment:Home.java
+  * '''File > Refresh'''
  
- === 9. Create a Home Page ===
+ === 10. Attach Project to Server Instance ===
  
- === 10. Add Tapestry libraries to the project ===
- ''(Note: I was not able to get a Tapestry user library to be recognized at 
runtime)''
+  * Select the server instance you defined in the '''Servers''' view
+  * Right-click and select '''Add and Remove Projects...'''
+  * Select your project in the '''Available Projects''' field
+  * Click '''Add >'''
+  * Click '''Finish'''
+ attachment:AddRemoveProjectsDialog.gif
  
- === 11. Attach Project to Server Instance ===
+ Your project should appear under the server in the '''Servers''' view. It 
will be published when the server starts. 
  
  == Verification ==
+ === View the site ===
- Start server
+  * Start the server
+ attachment:StartServer.gif
+  * browse to the context path you defined (e.g. 
http://localhost:8080/TapestryTest/) and you should see something like this: 
+ attachment:HelloWorld.gif
  
- Verify that caching of templates and specifications is disabled
+ === Verify that templates and specifications are not cached ===
+  * Open '''Home.html''' and change the title from `HelloWorld` to `HelloMoon`
+  * Open '''Home.page''' and change the value of `insertHeading` from 
`literal:Hello World` to `literal:Hello Moon`
+  * '''File > Save All'''
+  * Reload the page in your browser ''(do not restart the server)''
  
- Verify that context restarts automatically after modifying a Class file
+ The title and heading should now say `Hello Moon`. If this is not the case 
then there is a problem with the `org.apache.tapestry.disable-caching` VM 
argument. 
  
- == Troubleshooting ==
- Stop server and do a clean build
+ === Verify that context restarts automatically after modifying a Class file 
===
+  * Open `Home.java`
+  * Change `return "Hello World";` to `return "Hello Moon";`
+  * '''File > Save All'''
+  * If you watch the '''Server''' view you should see it reload the context 
after a moment. 
+  * Reload the page in your browser
  
- Manually inspect contents of `.deployables` directory (use ''Resource'' 
perspective or browse on file system)
+ The text should now say `Hello Moon`. 
  
- Relaunch Eclipse
+ == General troubleshooting strategies ==
+ Some things you can try if your project is not running as expected
  
+ === Do a clean build ===
+  * Stop the server
+ attachment:StopServer.gif
+  * '''Project > Clean...'''
+ attachment:CleanBuildDialog.gif
+ 
+ === Manually inspect contents of .deployables directory ===
+ ''''TODO: update for WTP 1.0''''
+ This is your ''live'' directory. It is where Tomcat loads the site from. 
+ Sometimes it may become unsynchronized (e.g. if you try to rename a jar while 
the server is running). 
+  * '''Window > Open Perspective > Other...'''
+  * Select the '''Resource''' perspective
+  * Look in the `.deployables` directory and ensure all the needed files are 
present
+ 
+ === Relaunch Eclipse ===
+  * '''File > Switch Workspace'''
+  * Press '''OK'''
+ Eclipse will restart and reload your current workspace
+ 
+ == Solutions to specific problems ==
+ === A change in a specification file does not appear in the browser ===
+ Make a small change to the specification file and resave it. Reload the page 
in the browser. In his book ''Enjoying Web Development with Tapestry'' Kent 
Tong reports the cause of this probem as Windows caching the file. 
+ 
+ === HTTP Status 404 ===
+ This can happen when the Tapestry libraries are missing
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to