Create your first Tapestry project
The easiest way to get started is to use Apache Maven to create your initial project; Maven can use an archetype (a kind of project template) to create a bare-bones Tapestry application for you.
One you have Maven installed, execute the command mvn archetype:generate -DarchetypeCatalog=
http://tapestry.apache.org
. Maven will (after performing a large number of one-time downloads) ask you questions about how to create the new project, including a group id (like a package name) and an artifact id for your new project.
No Format |
---|
$ mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://tapestry.apache.org -> quickstart (Tapestry 5.2.1-SNAPSHOT Quickstart Project)
2: http://tapestry.apache.org -> tapestry-archetype (Tapestry 4.1.6 Archetype)
Choose a number: : 1
Choose version:
1: 5.0.19
2: 5.1.0.5
3: 5.2.0
4: 5.2.1-SNAPSHOT
Choose a number: : 3
Define value for property 'groupId': : com.example
Define value for property 'artifactId': : newapp
Define value for property 'version': 1.0-SNAPSHOT:
Define value for property 'package': com.example: com.example.newapp
Confirm properties configuration:
groupId: com.example
artifactId: newapp
version: 1.0-SNAPSHOT
package: com.example.newapp
Y:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25 seconds
[INFO] Finished at: Tue Aug 17 14:01:50 PDT 2010
[INFO] Final Memory: 16M/81M
[INFO] ------------------------------------------------------------------------
/tmp
$ tree newapp
newapp
|-- pom.xml
`-- src
|-- main
| |-- java
| | `-- com
| | `-- example
| | `-- newapp
| | |-- components
| | | `-- Layout.java
| | |-- pages
| | | |-- About.java
| | | |-- Contact.java
| | | `-- Index.java
| | `-- services
| | `-- AppModule.java
| |-- resources
| | |-- com
| | | `-- example
| | | `-- newapp
| | | |-- components
| | | | `-- Layout.tml
| | | `-- pages
| | | `-- Index.properties
| | `-- log4j.properties
| `-- webapp
| |-- About.tml
| |-- Contact.tml
| |-- Index.tml
| |-- WEB-INF
| | |-- app.properties
| | `-- web.xml
| |-- favicon.ico
| `-- layout
| |-- images
| | |-- img01.jpg
| | |-- img02.jpg
| | |-- img03.jpg
| | |-- img04.jpg
| | |-- img05.gif
| | |-- img06.gif
| | |-- img07.gif
| | |-- img08.gif
| | |-- img09.gif
| | |-- img10.gif
| | |-- img11.gif
| | |-- img12.gif
| | |-- img13.gif
| | |-- img14.gif
| | |-- img15.gif
| | |-- img16.gif
| | |-- img17.gif
| | |-- img18.gif
| | |-- img19.gif
| | |-- img20.gif
| | `-- spacer.gif
| |-- layout.css
| `-- license.txt
|-- site
| |-- apt
| | `-- index.apt
| `-- site.xml
`-- test
|-- conf
| |-- testng.xml
| `-- webdefault.xml
|-- java
| `-- PLACEHOLDER
`-- resources
`-- PLACEHOLDER
25 directories, 44 files
/tmp
$
|
Warning |
---|
The exact content and layout of project generated from the archetype will change across different releases of Tapestry. |
Once it is created, you can load it into any IDE and start coding, or use mvn jetty:run
Footnote |
---|
Jetty is a well-known, open-source, high-performance servlet container. Jetty starts up quickly, and implements the official Servlet specification very closely. |
Obtain Help
Tapestry has an active user mailing list on which you can find a lot of valuable support. You can subscribe users-subscribe@tapestry.apache.org or look for an answer in the archives
Having trouble? Try our Frequently Asked Questions.
More
Checkout our Documentation page on which you will find a lot of resources written by committers and contributors.