WARNING: This is outdated content that applies primarily to Tapestry 4, not Tapestry 5.

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

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

This How-To was written and tested with the following configuration:

Prerequisites

Steps

1. Launch Eclipse

2. Define the JDK

Eclipse will launch with your machine's default JRE.

3. Associate Tapestry file extentions with the XML editor

ContentTypes.gif!

4. Define XML templates

Note: these templates are configured to be available in empty files. You can make them available in any XML file by editing the template and changing Context to All XML.

5. Define Tapestry XML DTD Location

Registering the Tapestry XML DTD allows <ctrl>+<space> auto-completion when editing tapestry files

6. Define a Server Runtime

This tells Eclipse where Tomcat is installed.

TomcatServerRuntime.gif!

7. Define a Server Instance

NewServer.gif!

NewServer2.gif!

A side-effect of creating a Server Configuration is a new Servers project will be created.

ServersProject.gif!

8. 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

ServerArguments.jpg!

9. Create a Dynamic Web Project

The Dynamic Web Project is a part of WTP. It adds automatic deployment support.

NewDynamicWebProject.gif!

Note: You can open the J2EE perspective later via Window > Open Perspective > Other...

10. 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

WebAppLibraries.gif!

WTP automatically adds the libraries to the build path and publishes them for Tomcat to use.

Note by cyrille37: There is a way to add libraries at runtime without add them as real files in the web-inf/lib folder ; Have a look at Eclipse's WTP documentation: Adding Web library projects

11. Setup a Skeleton Site

Creating Tapestry specification files is easy using the XML templates we defined previously.

ContentAssistPageSpec.gif!

Below are the files for the Hello World application used in the rest of this How-To. You can download these or re-create them from scratch.

web.xml

TapestryTest.application

Home.html

Home.page

Home.java

12. Attach Project to Server Instance

AddRemoveProjectsDialog.gif!

Your project should appear under the server in the Servers view. It will be published when the server starts.

Verification

View the site

StartServer.gif!

HelloWorld.gif!

Verify that templates and specifications are not cached

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.

Verify that context restarts automatically after modifying a Class file

The text should now say Hello Moon.

General troubleshooting strategies

Some things you can try if your project is not running as expected

Do a clean build

StopServer.gif!

Relaunch Eclipse

Eclipse will restart and reload your current workspace

Inspect the contents of the temporary deployment directory

During a build, WTP copies all deployable resources to a temporary directory. Tomcat loads the site from here. Sometimes it may become unsynchronized (particularly if you modify a jar while the server is running). Doing a clean build and restarting the workspace should take care of any synchronizing problems you have. But if you're still having problems you can examine the deployment directory.

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.

Some times, files are never deployed any more

Please, correct my poor english (Cyrille37)

Some times I add to erase WST.Server temporary deployement files because the "Run as Server" never copy files like home.html and more...

Stop Eclipse then

Erase file :
D:\evote.java\essais.withServer\.metadata\.plugins\org.eclipse.wst.server.core\publish.xml

and folders :
D:\evote.java\essais.withServer\.metadata\.plugins\org.eclipse.wst.server.core\publish D:\evote.java\essais.withServer\.metadata\.plugins\org.eclipse.wst.server.core\temp0

Then restart Eclipse.

HTTP Status 404

This can happen when the Tapestry libraries are missing