Start a New Spring-Hibernate-Tapestry Project

Tapestry 4 archetype –

Before You Begin

If you’ve never used Maven before, you’ll need to install Maven and add a M2_REPO classpath variable to your Eclipse preferences, under Window/Preferences/Java/Build Path/Classpath Variables. Maven will create a repository for you in your home directory in the .m2/repository directory, so your M2_REPO value should be something like C:\Documents and Settings\username\.m2\repository or /home/username/.m2/repository.
Please note that the sample project requires Java 5.

Run the Archetype

To start a project, use

mvn archetype:create -DarchetypeGroupId=com.codecafe.archetypes \
  -DarchetypeArtifactId=tapestry-simple                         \
  -DremoteRepositories=   \
  -DarchetypeVersion=4.1.2-SNAPSHOT -DgroupId=ca.intelliware    \

This will create a new project in a new directory for the named artifact (myProject) in this case.

Then change directories

cd myProject

into the project and run

mvn -DdownloadSources=true eclipse:eclipse

If it falls over wanting jta-1.0.1B.jar, do the following:

  1. copy the jta-1.0.1B.jar from iwdbackup to your local file system
  2. run a special Maven command to install it into your local Maven repository:

mvn install:install-file -Dfile=jta-1.0.1B.jar -DgroupId=javax.transaction \
  -DartifactId=jta -Dpackaging=jar -Dversion=1.0.1B

That gets you a skeleton project with Spring and Tapestry that you can import into Eclipse and start working with. You can run your site with

mvn jetty6:run

and see the results at http://localhost:8080/myProject/app, or use MyEclipse or some other mechanism to deploy and run it.

We intend to have our own Spring/Hibernate/Tapestry/Intelliware Commons/{Acegi?} archetype at some point Real Soon Now, which will include some simple unit tests for the code included in the archetype.

Add Hibernate

To add Hibernate, add the following to the pom.xml:



If you want HSQL, also add


or if you want MySQL, use


or so forth.

It also might be worthwhile to keep your web layer and your data layer in separate projects. See Split Your Project Into Sub-Projects for more information about how to set your project up in a multiproject structure.

Add More

Want to add more dependencies? Look up your package through the search engine at and copy the dependency stanza from the result page into the dependencies part of your pom.xml. It’s that simple.

For internal projects within Intelliware, Intelliware Commons modules may be similarly consumed as dependencies:


You can even specify ranges for versions using the mathematical syntax for number ranges. For example, if you need Hibernate 3.2 or later, but don’t care whether it’s 3.2, 3.2.1, or 3.2.2, you could specify


Be sure to re-run mvn eclipse:eclipse whenever you add or remove a dependency to your pom.xml.

Hook Up to Repository and Source Control

For internal Intelliware projects, you’ll want to include our parent POM, which has pointers to our internal Maven repository. Add a stanza to your pom.xmllike this:


If you’re reading this from outside Intelliware, see the Maven docs for instructions on how to set up repositories in your pom.xml and settings.xml.

You’ll also need to add source control to your project. Add a stanza like this to your pom.xml:


It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

1 thought on “Start a New Spring-Hibernate-Tapestry Project

  1. Pingback: Array |

Leave a Reply