...
Our final command line is:
Code Block |
|
|
mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org
|
It will then prompt you to pick the archetype - choose the latest Tapestry 5.X Quickstart Project, enter the group id, artifact id, version and package when prompted.
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
Define value for property 'groupId': : com.example
Define value for property 'artifactId': : tutorial1
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.example: : com.example.tutorial
Confirm properties configuration:
groupId: com.example
artifactId: tutorial1
version: 1.0-SNAPSHOT
package: com.example.tutorial
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: tutorial1
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.example.tutorial
[INFO] Parameter: packageInPathFormat, Value: com/example/tutorial
[INFO] Parameter: package, Value: com.example.tutorial
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: tutorial1
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/test/java
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/main/webapp
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/main/resources/com/example/tutorial
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/test/resources
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/test/conf
[WARNING] Don't override file /Users/joeuser/workspace/tutorial1/src/site
[INFO] project created from Archetype in dir: /Users/joeuser/workspace/tutorial1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.398s
[INFO] Finished at: Fri Mar 1 11:46:08 PST 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
|
...
Info |
| title |
Maven Behind a Firewall |
|
| If you are behind a firewall, before running any "mvn" commands, you will need to configure your proxy settings in settings.xml. Here is an example:
Code Block |
|
|
|
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>myProxyServer.com</host>
<port>8080</port>
<username>joeuser</username>
<password>myPassword</password>
<nonProxyHosts></nonProxyHosts>
</proxy>
</proxies>
<localRepository>C:/Users/joeuser/.m2/repository</localRepository>
</settings>
|
Of course, adjust the localRepository element to match the correct path for your computer. |
...
Change into the newly created directory, and execute the command:
Code Block |
|
|
mvn jetty:run
|
Again, the first time, there's a dizzying number of downloads, but before you know it, the Jetty servlet container is up and running.
Once Jetty is initialized (which only takes a few seconds), you'll see the following in your console:
No Format |
TranslatorSource: DEFINED
TypeCoercer: REAL
URLEncoder: DEFINED
UpdateListenerHub: DEFINED
ValidateBindingFactory: DEFINED
ValidationConstraintGenerator: DEFINED
ValidationDecoratorFactory: DEFINED
ValidatorMacro: DEFINED
ValueEncoderSource: DEFINED
86.77% unrealized services (164/189)
Application 'app' (version 1.0-SNAPSHOT-DEV) startup time: 137 ms to build IoC Registry, 705 ms overall.
______ __ ____
/_ __/__ ____ ___ ___ / /_______ __ / __/
/ / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \
/_/ \_,_/ .__/\__/___/\__/_/ \_, / /____/
/_/ /___/ 5.3.7 (development mode)
2011-11-22 11:46:45.636::INFO: Started [email protected]:8080
[INFO] Started Jetty Server
|
You can now open a web browser to http://localhost:8080/tutorial1/ to see the running application:
Image Removed
Image Added
HTML |
<div style="clear: both"></div>
|
The date and time in the middle of the page proves that this is a live application.
This is a complete little application; it doesn't do much, but it demonstrate how to create a number of pages sharing a common layout, and demonstrates some simple navigation and link handling. You can see that it has three different pages that share a common layout
Wiki Markup |
{footnote}Layout is a loose term meaning common look and feel and navigation across many or all of the pages of an application. Often an application will include a Layout component to provide that commonness.{footnote}
|
...
. (Layout is a loose term meaning common look and feel and navigation across many or all of the pages of an application. Often an application will include a Layout component to provide that commonness.)
Warning |
| You should hit Control-C in the Terminal window to close down Jetty before continuing with the tutorial. |
Wiki Markup |
{
|
...