---- Quickstart Archetype ---- Quickstart Archetype An {{{http://maven.apache.org/plugins/maven-archetype-plugin/index.html}archetype}} is the Maven term for a project template. Using a Maven archetype, you can create an empty shell of your project in just seconds. What you end up with is a basic Maven project, ready to build and deploy. First, you must decide on your group id, artifact id, and version number. For example, let's choose <> for our group id, <> 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. From the command line, you execute the following command (it's a bit of a doozy): mvn archetype:create -DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart -DarchetypeVersion=5.0.3 -DgroupId=<> -DartifactId=<> -DpackageName=<> -Dversion=<<1.0.0-SNAPSHOT>> Maven will use the information from that massive command line to locate and configure the archetpe, and produce the project: +---+ $ mvn archetype:create -DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart -DarchetypeVersion=5.0.4 -DgroupId=org.example -DartifactId=myapp -DpackageName=org.example.myapp -Dversion=1.0.0-SNAPSHOT [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ---------------------------------------------------------------------------- [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ----------------------------------------------------------------------------\ . . . [INFO] [archetype:create] [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating Archetype: quickstart:5.0.4 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: org.example [INFO] Parameter: packageName, Value: org.example.myapp [INFO] Parameter: basedir, Value: /Users/Howard/work [INFO] Parameter: package, Value: org.example.myapp [INFO] Parameter: version, Value: 1.0.0-SNAPSHOT [INFO] Parameter: artifactId, Value: myapp [INFO] ********************* End of debug info from resources from generated POM *********************** [WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/src/main/webapp/WEB-INF/Start.html [line 11,column 34] : ${currentTime} is not a valid reference. [INFO] Archetype created in dir: /Users/Howard/work/myapp [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Tue Jan 23 11:57:11 PST 2007 [INFO] Final Memory: 4M/8M [INFO] ------------------------------------------------------------------------ ~/work $ +---+ Maven has combined your information to form a new directory containing your application. It has created a Maven pom.xml, a web.xml, a log4j.properties file, and a starting page (Start.html and Start.java) with each file in its correct location. It also creates a starter Tapestry IoC module for the application (AppModule.java). You can run the application directly, using the Jetty servlet container: +---+ $ cd myapp ~/work/myapp $ mvn jetty:run [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'jetty'. [INFO] ---------------------------------------------------------------------------- [INFO] Building myapp Tapestry 5 Application [INFO] task-segment: [jetty:run] [INFO] ---------------------------------------------------------------------------- [INFO] Preparing jetty:run [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] Compiling 1 source file to /Users/Howard/work/myapp/target/classes [INFO] [jetty:run] [INFO] Configuring Jetty for project: myapp Tapestry 5 Application [INFO] Webapp source directory = /Users/Howard/work/myapp/src/main/webapp [INFO] web.xml file = /Users/Howard/work/myapp/src/main/webapp/WEB-INF/web.xml [INFO] Classes = /Users/Howard/work/myapp/target/classes 2007-01-23 12:00:56.656::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = /myapp [INFO] Tmp directory = /Users/Howard/work/myapp/target/work [INFO] Web defaults = jetty default [INFO] Webapp directory = /Users/Howard/work/myapp/src/main/webapp [INFO] Starting jetty 6.1.0pre0 ... 2007-01-23 12:00:56.739::INFO: jetty-6.1.0pre0 [INFO] Classpath = [file:/Users/Howard/work/myapp/target/classes/, file:/Users/Howard/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar, . . . [INFO] TapestryFilter Startup time: 306 ms to build IoC Registry, 761 ms overall. 2007-01-23 12:00:57.962::INFO: Started SelectChannelConnector @ 0.0.0.0:8080 [INFO] Started Jetty Server +---+ You can now see your running application as {{{http://localhost:8080/myapp}http://localhost:8080/myapp}}. You can hit Control-C to stop Jetty. About Snapshots Tapestry 5 is currently in a pre-release stage. The Tapestry libraries, including this archetype, are being distributed as snaphots, subject to change at any time. They are not yet in the central Maven repository. To make use of the Tapestry snapshots, append <<<-DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository/>>> to the command line when invoking Maven. The generated POM includes entries to automatically search the Apache snapshot repository, so you won't need to use <<<-DremoveRepositories>>> after creating your initial project.