Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Correct minimum Correct minimum Java version

...

Scrollbar

As much as I we would like to dive right into Tapestry right nowthe code, we must first talk about set up your development environment. The joy and the pain of Java development is the volume of choice available. There's just a bewildering number of JDKs, IDEs and other TLA1s out there.Let's talk about a stack of tools, all open source and freely available, that you'll need to setup. Likely you have some of these, or some version of thesereasonable alternatives, already on your development machine.

JDK 1.

...

Tapestry 5 makes use of features of JDK 1.5. This includes Java Annotations, and a little bit of Java Generics.

Eclipse 3.3

Since we're emphasizing a free and open source stack, we'll concentrate on the best free IDE.

8 or Newer

This tutorial uses the latest released version of Tapestry, which requires Java Development Kit (JDK) version 1.8 or newer. (But see Supported Environments and Versions if you want to use an older version of JDK or Tapestry.)

Eclipse IDE

For this tutorial we'll assume you're using Eclipse as your Integrated Development Environment (IDE). Eclipse is a popular IDE, but feel free to adapt these instructions to IntelliJ, NetBeans, or any other.

Eclipse Eclipse 3.3 comes in various flavors, and includes a reasonable XML editor built-in.

Jetty 5.1

Jetty is an open source servlet container created by Greg Wilkins of Webtide (which offers commercial support for Jetty). Jetty is high performance and designed for easy embedding in other software. I've chosen the 5.1 release, rather than the cutting edge Jetty 6, because it is compatible with Jetty Launcher (see below).

You can find out more about Jetty from its home page: http://mortbay.org.

You can download Jetty from http://docs.codehaus.org/display/JETTY/Downloading+Jetty.

Note about Log4J: Jetty includes an incompatible version of Log4J. If using Jetty 5, you must get a more recent copy of Log4J, version 1.2.14 or later, and replace the copy of log4j.jar in the Jetty ext (external libraries) directory. Just delete the old log4j.jar and copy the new one in its place.

Jetty Launcher

Jetty Launcher is a plugin for Eclipse that makes it easy to launch Jetty applications from within Eclipse. This is a great model, since you can run or debug directly from you workspace without wasting time packaging and deploying.

Jetty Launcher was created by Geoff Longman, and is available from http://jettylauncher.sourceforge.net/. Installation is easy, simply point Eclipse's update manager at http://jettylauncher.sourceforge.net/updates/.

If you are behind a firewall, you will need to set up a manual proxy configuration in Eclipse (Window, Preferences..., General, Network Connections).

Caution: JettyLauncher is only compatible with Jetty 4 and Jetty 5. It does not work with Jetty 6.

Maven 2.0.8

Maven is a software build tool of rather epic ambitions. It has a very sophisticated plugin system that allows it to do virtually anything, though compiling Java code, building WAR and JAR files, and creating reports and web sites are its forte.

It can be downloaded from the eclipse.org web site. We recommend the latest version of Eclipse IDE for Java Developers (but anything from version 3.7 onward should work fine).

Apache Maven 3

Maven is a software build tool with the ability to automatically Perhaps the biggest advantage of Maven over, say, Ant, is that it can download project dependencies (such as the Tapestry JAR files, and the JAR files that Tapestry itself depends on) automatically for you, from one of several central repositories.

Maven is not essential for using Tapestry, but is especially helpful when performing the initial set-up of a Tapestry application. Feel free to substitute Gradle or Ivy if you prefer.

Eclipse comes with a Maven plugin, M2Eclipse (also known as m2e) with an embedded version of Maven. We'll use that here for simplicity's sake. Alternatively, you could install Maven We'll be using Maven to set up our Tapestry applications. Maven 2.0.8 is available from http://maven.apache.org/download.html and use it from the command line ("mvn").

Maven Plugin

The Maven Plugin for Eclipse integrates Maven and Eclipse. It includes some features for editing the pom.xml (the Maven project description file which identifies, among many other things, what JAR files are needed by the project). More importantly, a Maven-enabled project automatically stays synchronized with the POM, automatically linking Eclipse project classpath to files from the local Maven repository.

The plugin is available by pointing the Eclipse update manager at http://m2eclipse.codehaus.org/update/. Make sure to use version 0.0.10.

Tapestry 5.0.x

You should not have to download this directly; as we'll see, Maven should take care of downloading Tapestry, and its dependencies, as needed.

Caution: this book is being written in parallel with Tapestry 5. In some cases, the screenshots may not be entirely accurate and the version number for Tapestry is in flux, with snapshot releases occurring frequently, and new dot releases every few weeks. So, for example, is 5.0.5 is not available, you can use 5.0.4 instead.

Jetty

For simplicity, this tutorial uses Jetty, a lightweight open source web server and servlet container available from the Eclipse Foundation. Of course, you could use pretty much any other Java servlet container (Tomcat, Glassfish, JBoss, etc), but the instructions that follow assume Jetty.

We will use Maven to download and run Jetty automatically, so you will NOT have to download it for this tutorial. (Alternatively, you could download and install the RunJettyRun Eclipse plugin from the Eclipse Marketplace.)

Tapestry

Tapestry is available as a set of JAR files, but you will not have to download them yourself. As with Jetty, Maven will take care of downloading Tapestry and its dependencies.

Next: Creating The Skeleton Application

...

Scrollbar
FirstContinue on to Chapter 2: Your First Tapestry Application