Tapestry Archetype (For Tapestry 4.1)

An archetype is a Maven 2 form of a project template. You can create an empty shell of your project quickly.

What you should know: the latest and greatest Tapestry 5 is just around the corner. There's an excellent archetype for getting up and running with it here. This archetype is inspired by that one.

This archetype creates a very simple application using Tapestry 4.1 (the Dojo-enabled Tapestry versions.)

If you don't have Maven, you can get it here. Install it and then invoke:

mvn archetype:create -DarchetypeGroupId=org.apache.tapestry \
-DarchetypeArtifactId=tapestry-archetype \
-DarchetypeVersion=4.1.6-SNAPSHOT -DgroupId=org.example -DartifactId=myapp

First, you must decide on your group id, artifact id, and version number. For example, let's choose org.example for our group id, myapp for the artifactId, and 1.0.0-SNAPSHOT for the version number. We also need a root package name, which we'll create by combining the group id and the artifact id.

Again, the first time you do this, you'll see a large number of download messages.

Also, if you're trying to use a SNAPSHOT version of the archetype, add -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository/ to the command line arguments... and finally, if you keep getting no archetype found messages from maven, add the -U flag to force maven to check for updates on releases and snapshots on remote repositories.

This should yeild a project in the directory in which you invoked the command that has all the fixings for experimenting with Tapestry.

You may run the application by issuing mvn jetty:run. Jetty will monitor your project directory and periodically reload the files (every 10 seconds, in this case). We've also configured Tapestry to automatically reload the templates (typically, it caches the files. This setting won't affect the final .war you build, but is great for development). Thus, you can modify any .script/.page/.jwc/.html file and expect an instantaneous result. If you modify and recompile a java class file, Jetty will reload the context for you and you'll be up and running within 10 seconds.

You can now see your running application at http://localhost:8080/myapp.

You can hit Control-C to stop Jetty.

Maven also comes pre-packaged with plugins for getting up and running with your favorite IDE. Off the top of my head, I know that mvn idea:idea and mvn eclipse:eclipse will do the right thing for you. You can open the project with your favorite editor, make your change and then reload!