Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Cleaned up maven instructions to give the reader a copy-paste ready command. Also changed instructions to direct the reader to run the application first of all, then open the IDE

...

One you have Maven installed, execute the command (copy and paste it as-is)

No Format
mvn archetype:generate -DarchetypeCatalog -DarchetypeVersion=5.1.0.5 -Darchetype.interactinteractive=false -DgroupId=com.example -DarchetypeArtifactId=quickstart -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.tapestry -Dpackage=com.example.newapp -DartifactId=newapp --batch-mode -DarchetypeRepository=http://tapestry.apache.org archetype:generate

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 projecta skeleton project ready to run.

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 InteractiveBatch mode
[INFO] NoArchetype 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:
by properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 251 secondssecond
[INFO] Finished at: TueMon AugNov 1729 1418:0130:5020 PDTCET 2010
[INFO] Final Memory: 16M20M/81M213M
[INFO] ------------------------------------------------------------------------
/tmp
$

Once it is created, you can load it into any IDE and start coding, or use mvn run

No Format

mvn jetty:run

and after some

Footnote

Jetty is a well-known, open-source, high-performance servlet container. Jetty starts up quickly, and implements the official Servlet specification very closely.

. Again, more one-time downloads , but then you can open your browser to http://localhost:8080 to run see the application running.

You can also load the newly-created project it into any IDE and start coding. See the next section on where to find the different components of the application.

For more information on this, try the Tapestry Tutorial which goes into more detail about setting up your project, as well as loading it into Eclipse ... then continues on to teach you more about Tapestry.

Exploring the test project

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/webapp. They are basically HTML with some special markup tagsto link the template to the Java class and to ready-made components you can use to speed up your development.

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

...