Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed garbled footnotes, made image bigger

...

Once you have Maven installed, execute the following command:

Code Blocknoformat

mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org

Maven will prompt you for the archetype to create ("Tapestry 5 Quickstart Project") and the exact version number ("5.3.7", at the time of writing). It also asks you for a group id, an artifact id, and a version number. You can see this in the following transcript:

No Format

$ mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom ---
[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 -> org.apache.tapestry:quickstart (Tapestry 5 Quickstart Project)
2: http://tapestry.apache.org -> org.apache.tapestry:tapestry-archetype (Tapestry 4.1.6 Archetype)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose version:
1: 5.0.19
2: 5.1.0.5
3: 5.2.6
4: 5.3.7
Choose a number: 4: 4
Downloading: http://tapestry.apache.org/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.jar
Downloading: http://repo1.maven.org/maven2/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.jar (64 KB at 69.3 KB/sec)
Downloading: http://tapestry.apache.org/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.pom
Downloading: http://repo1.maven.org/maven2/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/tapestry/quickstart/5.3.6/quickstart-5.3.7.pom (400 B at 1.0 KB/sec)
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] Using following parameters for creating project from Archetype: quickstart:5.3.7
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: newapp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.example.newapp
[INFO] Parameter: packageInPathFormat, Value: com/example/newapp
[INFO] Parameter: package, Value: com.example.newapp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: newapp
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/test/java
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/main/webapp
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/main/resources/com/example/newapp
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/test/resources
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/test/conf
[WARNING] Don't override file /Users/hlship/workspaces/github/newapp/src/site
[INFO] project created from Archetype in dir: /Users/hlship/workspaces/github/newapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.062s
[INFO] Finished at: Fri Mar 1 11:11:14 PST 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------

...

To run the skeleton application, change to the newapp directory and execute:

No Format

mvn jetty:run

After some more one-time downloads you can open your browser to http://localhost:8080/newapp to see the application running:

Image RemovedImage Added

The application consists of three pages sharing a common look and feel. The initial page, Index, allows you to perform some basic operations.

...

The archetype creates the following files:

No Format

newapp
├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── com
    │   │       └── example
    │   │           └── newapp
    │   │               ├── components
    │   │               │   └── Layout.java
    │   │               ├── pages
    │   │               │   ├── About.java
    │   │               │   ├── Contact.java
    │   │               │   └── Index.java
    │   │               └── services
    │   │                   ├── AppModule.java
    │   │                   ├── DevelopmentModule.java
    │   │                   └── QaModule.java
    │   ├── resources
    │   │   ├── com
    │   │   │   └── example
    │   │   │       └── newapp
    │   │   │           ├── components
    │   │   │           │   └── Layout.tml
    │   │   │           └── pages
    │   │   │               ├── About.tml
    │   │   │               ├── Contact.tml
    │   │   │               ├── Index.properties
    │   │   │               └── Index.tml
    │   │   └── log4j.properties
    │   └── webapp
    │       ├── WEB-INF
    │       │   ├── app.properties
    │       │   └── web.xml
    │       ├── favicon.ico
    │       └── layout
    │           ├── images
    │           │   ├── img01.jpg
    │           │   ├── img03.jpg
    │           │   ├── img04.jpg
    │           │   ├── img08.gif
    │           │   ├── img09.gif
    │           │   ├── img10.gif
    │           │   ├── img11.gif
    │           │   ├── img12.gif
    │           │   ├── img13.gif
    │           │   ├── img14.gif
    │           │   ├── img18.gif
    │           │   ├── img19.gif
    │           │   └── img20.gif
    │           ├── layout.css
    │           └── license.txt
    ├── site
    │   ├── apt
    │   │   └── index.apt
    │   └── site.xml
    └── test
        ├── conf
        │   ├── testng.xml
        │   └── webdefault.xml
        ├── java
        │   └── PLACEHOLDER
        └── resources
            └── PLACEHOLDER

A Tapestry application is composed of pages, each page consisting of one template file and one Java class.

Tapestry page templates have the .tml extension and are found in src/main/resources/com/example/newapp/pages

...

 (that is, in the 

...

com.example.newapp.pages

...

 package).

...

 Templates are essentially HTML with some special markup to reference properties in the corresponding Java class and to reference ready-made or custom components.

Tapestry page classes are found in src/main/java/com/example/newapp/pages and their name matches their template name (Index.tml -> Index.java).

...

Having trouble? Try our Frequently Asked Questions.

...

 

  Wiki Markup{display-footnotes}