Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tapestry 5.3 Maven Archetype

DZone's Guide to

Tapestry 5.3 Maven Archetype

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

After struggling most of yesterday day, I finally have the Maven archetype working.

Use the command:

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

This points Maven at the Tapestry-specific Archetype Catalog, you want the first option ("Tapestry 5 Quickstart Project"), then choose the fourth option ("5.3-beta-20").

I need to fix something broken in the CSS of the archetype; otherwise it's working nicely, and demonstrates a bunch of new features in Tapestry 5.3; it also makes use of up-to date features, such as using the @Import annotation (instead of the now removed @IncludeStylesheet annotation), and some Ajax features on the first page.

I may switch things around to make use of Twitter's Bootstrap CSS stylesheets.

Here's a full session of creating the application and getting it running; it took less than 30 seconds

$ 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-beta-20
Choose a number: 4: 4
Define value for property 'groupId': : org.example
Define value for property 'artifactId': : t53app
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  org.example: : org.example.t53app.web
Confirm properties configuration:
groupId: org.example
artifactId: t53app
version: 1.0-SNAPSHOT
package: org.example.t53app.web
 Y: : 
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: quickstart:5.3-beta-20
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: artifactId, Value: t53app
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.example.t53app.web
[INFO] Parameter: packageInPathFormat, Value: org/example/t53app/web
[INFO] Parameter: package, Value: org.example.t53app.web
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: artifactId, Value: t53app
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/test/java
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/main/webapp
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/main/resources/org/example/t53app/web
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/test/resources
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/test/conf
[WARNING] Don't override file /Users/hlship/workspaces/apache/t53app/src/site
[INFO] project created from Archetype in dir: /Users/hlship/workspaces/apache/t53app
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.858s
[INFO] Finished at: Thu Oct 13 10:56:31 PDT 2011
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
~/workspaces/apache
$ cd t53app/
~/workspaces/apache/t53app
$ mvn jetty:run
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.example:t53app:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 81, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 91, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building t53app Tapestry 5 Application 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-jetty-plugin:6.1.16:run (default-cli) @ t53app >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ t53app ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ t53app ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 7 source files to /Users/hlship/workspaces/apache/t53app/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ t53app ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ t53app ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< maven-jetty-plugin:6.1.16:run (default-cli) @ t53app <<<
[INFO] 
[INFO] --- maven-jetty-plugin:6.1.16:run (default-cli) @ t53app ---
[INFO] Configuring Jetty for project: t53app Tapestry 5 Application
[INFO] Webapp source directory = /Users/hlship/workspaces/apache/t53app/src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] web.xml file = /Users/hlship/workspaces/apache/t53app/src/main/webapp/WEB-INF/web.xml
[INFO] Classes = /Users/hlship/workspaces/apache/t53app/target/classes
2011-10-13 10:56:44.441::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /t53app
[INFO] Tmp directory =  determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] Webapp directory = /Users/hlship/workspaces/apache/t53app/src/main/webapp
[INFO] Starting jetty 6.1.16 ...
2011-10-13 10:56:44.554::INFO:  jetty-6.1.16
2011-10-13 10:56:44.690::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.json.services.JSONModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.yuicompressor.services.YuiCompressorModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.TapestryModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.internal.services.InternalModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.assets.AssetsModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.pageload.PageLoadModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.example.t53app.web.services.AppModule
[INFO] ioc.RegistryBuilder Adding module definition for class org.example.t53app.web.services.DevelopmentModule
[INFO] TapestryModule.ComponentClassResolver Available pages (8):
              (blank): org.example.t53app.web.pages.Index
                About: org.example.t53app.web.pages.About
              Contact: org.example.t53app.web.pages.Contact
      ExceptionReport: org.apache.tapestry5.corelib.pages.ExceptionReport
                Index: org.example.t53app.web.pages.Index
          PageCatalog: org.apache.tapestry5.corelib.pages.PageCatalog
PropertyDisplayBlocks: org.apache.tapestry5.corelib.pages.PropertyDisplayBlocks
   PropertyEditBlocks: org.apache.tapestry5.corelib.pages.PropertyEditBlocks
        ServiceStatus: org.apache.tapestry5.corelib.pages.ServiceStatus

[INFO] TapestryModule.ComponentClassResolver Available components (55):
               ActionLink: org.apache.tapestry5.corelib.components.ActionLink
               AddRowLink: org.apache.tapestry5.corelib.components.AddRowLink
             AjaxFormLoop: org.apache.tapestry5.corelib.components.AjaxFormLoop
                   Alerts: org.apache.tapestry5.corelib.components.Alerts
                      Any: org.apache.tapestry5.corelib.components.Any
              BeanDisplay: org.apache.tapestry5.corelib.components.BeanDisplay
             BeanEditForm: org.apache.tapestry5.corelib.components.BeanEditForm
               BeanEditor: org.apache.tapestry5.corelib.components.BeanEditor
                 Checkbox: org.apache.tapestry5.corelib.components.Checkbox
                Checklist: org.apache.tapestry5.corelib.components.Checklist
                DateField: org.apache.tapestry5.corelib.components.DateField
                 Delegate: org.apache.tapestry5.corelib.components.Delegate
                  Doctype: org.apache.tapestry5.corelib.components.Doctype
                  Dynamic: org.apache.tapestry5.corelib.components.Dynamic
                    Error: org.apache.tapestry5.corelib.components.Error
                   Errors: org.apache.tapestry5.corelib.components.Errors
                EventLink: org.apache.tapestry5.corelib.components.EventLink
         ExceptionDisplay: org.apache.tapestry5.corelib.components.ExceptionDisplay
                     Form: org.apache.tapestry5.corelib.components.Form
             FormFragment: org.apache.tapestry5.corelib.components.FormFragment
             FormInjector: org.apache.tapestry5.corelib.components.FormInjector
                     Grid: org.apache.tapestry5.corelib.components.Grid
                 GridCell: org.apache.tapestry5.corelib.components.GridCell
              GridColumns: org.apache.tapestry5.corelib.components.GridColumns
                GridPager: org.apache.tapestry5.corelib.components.GridPager
                 GridRows: org.apache.tapestry5.corelib.components.GridRows
                   Hidden: org.apache.tapestry5.corelib.components.Hidden
                       If: org.apache.tapestry5.corelib.components.If
                    Label: org.apache.tapestry5.corelib.components.Label
                   Layout: org.example.t53app.web.components.Layout
               LinkSubmit: org.apache.tapestry5.corelib.components.LinkSubmit
                     Loop: org.apache.tapestry5.corelib.components.Loop
                   Output: org.apache.tapestry5.corelib.components.Output
                OutputRaw: org.apache.tapestry5.corelib.components.OutputRaw
                 PageLink: org.apache.tapestry5.corelib.components.PageLink
                  Palette: org.apache.tapestry5.corelib.components.Palette
            PasswordField: org.apache.tapestry5.corelib.components.PasswordField
       ProgressiveDisplay: org.apache.tapestry5.corelib.components.ProgressiveDisplay
          PropertyDisplay: org.apache.tapestry5.corelib.components.PropertyDisplay
           PropertyEditor: org.apache.tapestry5.corelib.components.PropertyEditor
                    Radio: org.apache.tapestry5.corelib.components.Radio
               RadioGroup: org.apache.tapestry5.corelib.components.RadioGroup
            RemoveRowLink: org.apache.tapestry5.corelib.components.RemoveRowLink
             RenderObject: org.apache.tapestry5.corelib.components.RenderObject
                   Select: org.apache.tapestry5.corelib.components.Select
                   Submit: org.apache.tapestry5.corelib.components.Submit
           SubmitNotifier: org.apache.tapestry5.corelib.components.SubmitNotifier
                 TextArea: org.apache.tapestry5.corelib.components.TextArea
                TextField: org.apache.tapestry5.corelib.components.TextField
               TextOutput: org.apache.tapestry5.corelib.components.TextOutput
                     Tree: org.apache.tapestry5.corelib.components.Tree
                  Trigger: org.apache.tapestry5.corelib.components.Trigger
                   Unless: org.apache.tapestry5.corelib.components.Unless
                     Zone: org.apache.tapestry5.corelib.components.Zone
t5internal/InternalLayout: org.apache.tapestry5.internal.t5internal.components.InternalLayout

[INFO] TapestryModule.ComponentClassResolver Available mixins (10):
      Autocomplete: org.apache.tapestry5.corelib.mixins.Autocomplete
       DiscardBody: org.apache.tapestry5.corelib.mixins.DiscardBody
    FormFieldFocus: org.apache.tapestry5.corelib.mixins.FormFieldFocus
          NotEmpty: org.apache.tapestry5.corelib.mixins.NotEmpty
    RenderClientId: org.apache.tapestry5.corelib.mixins.RenderClientId
    RenderDisabled: org.apache.tapestry5.corelib.mixins.RenderDisabled
   RenderInformals: org.apache.tapestry5.corelib.mixins.RenderInformals
RenderNotification: org.apache.tapestry5.corelib.mixins.RenderNotification
   TriggerFragment: org.apache.tapestry5.corelib.mixins.TriggerFragment
       ZoneRefresh: org.apache.tapestry5.corelib.mixins.ZoneRefresh

[INFO] tapestry5.TapestryFilter Startup status:

Services:

             ActionRenderResponseGenerator: DEFINED
          AjaxComponentEventRequestHandler: DEFINED
         AjaxComponentEventResultProcessor: DEFINED
                  AjaxFormUpdateController: DEFINED
               AjaxPartialResponseRenderer: DEFINED
                      AjaxResponseRenderer: DEFINED
                              AlertManager: DEFINED
                       ApplicationDefaults: REAL
                        ApplicationGlobals: REAL
                    ApplicationInitializer: REAL
                   ApplicationStateManager: DEFINED
 ApplicationStatePersistenceStrategySource: DEFINED
                           AspectDecorator: VIRTUAL
                       AssetBindingFactory: DEFINED
                           AssetDispatcher: DEFINED
                       AssetObjectProvider: REAL
                      AssetPathConstructor: DEFINED
                        AssetPathConverter: DEFINED
                      AssetResourceLocator: DEFINED
                               AssetSource: VIRTUAL
                             BaseURLSource: DEFINED
                   BeanBlockOverrideSource: DEFINED
                           BeanBlockSource: DEFINED
                           BeanModelSource: DEFINED
                             BindingSource: DEFINED
                              ChainBuilder: VIRTUAL
                              ClassFactory: BUILTIN
                          ClassNameLocator: REAL
                ClasspathAssetAliasManager: DEFINED
                     ClasspathAssetFactory: DEFINED
                     ClasspathURLConverter: REAL
                     ClientBehaviorSupport: DEFINED
                         ClientDataEncoder: DEFINED
              ClientPersistentFieldStorage: DEFINED
             ClientPersistentFieldStrategy: DEFINED
                       ComponentClassCache: VIRTUAL
                     ComponentClassFactory: DEFINED
                    ComponentClassResolver: REAL
             ComponentClassTransformWorker: DEFINED
      ComponentClassesInvalidationEventHub: REAL
                  ComponentDefaultProvider: DEFINED
                 ComponentEventLinkEncoder: DEFINED
             ComponentEventLinkTransformer: DEFINED
              ComponentEventRequestHandler: DEFINED
             ComponentEventResultProcessor: DEFINED
          ComponentInstanceResultProcessor: DEFINED
               ComponentInstantiatorSource: DEFINED
     ComponentMessagesInvalidationEventHub: DEFINED
                   ComponentMessagesSource: DEFINED
                      ComponentModelSource: DEFINED
       ComponentPageElementResourcesSource: DEFINED
                     ComponentProxyFactory: DEFINED
                   ComponentRequestHandler: DEFINED
          ComponentRequestSelectorAnalyzer: DEFINED
                  ComponentResourceLocator: DEFINED
                           ComponentSource: DEFINED
                  ComponentTemplateLocator: DEFINED
                   ComponentTemplateSource: DEFINED
    ComponentTemplatesInvalidationEventHub: DEFINED
                       CompressionAnalyzer: DEFINED
                       ContentTypeAnalyzer: DEFINED
                                   Context: DEFINED
                       ContextAssetFactory: DEFINED
                     ContextBindingFactory: DEFINED
                        ContextPathEncoder: DEFINED
                       ContextValueEncoder: DEFINED
                                CookieSink: DEFINED
                              CookieSource: DEFINED
                                   Cookies: DEFINED
                          DataTypeAnalyzer: DEFINED
                   DefaultDataTypeAnalyzer: DEFINED
              DefaultImplementationBuilder: VIRTUAL
                         DeferredExecution: DEFINED
                     DynamicTemplateParser: VIRTUAL
                      EndOfRequestEventHub: REAL
                               Environment: DEFINED
                EnvironmentalShadowBuilder: VIRTUAL
                         ExceptionAnalyzer: DEFINED
                          ExceptionTracker: DEFINED
                           FactoryDefaults: REAL
                     FieldTranslatorSource: DEFINED
                    FieldValidationSupport: DEFINED
               FieldValidatorDefaultSource: DEFINED
                      FieldValidatorSource: DEFINED
                               FormSupport: DEFINED
                                 Heartbeat: DEFINED
                  HiddenFieldLocationRules: DEFINED
                        HttpServletRequest: DEFINED
                 HttpServletRequestHandler: VIRTUAL
                       HttpServletResponse: DEFINED
                        IgnoredPathsFilter: DEFINED
                         InjectionProvider: DEFINED
     InternalComponentInvalidationEventHub: REAL
                    InternalRequestGlobals: DEFINED
            JavaScriptStackPathConstructor: DEFINED
                     JavaScriptStackSource: DEFINED
                         JavaScriptSupport: DEFINED
                               LazyAdvisor: DEFINED
                           LinkCreationHub: DEFINED
                                LinkSource: DEFINED
                           LinkTransformer: DEFINED
                        LocalizationSetter: DEFINED
                          LocationRenderer: DEFINED
                              LoggerSource: BUILTIN
                            LoggingAdvisor: DEFINED
                          LoggingDecorator: DEFINED
                            MarkupRenderer: DEFINED
                       MarkupWriterFactory: DEFINED
                          MasterDispatcher: DEFINED
                      MasterObjectProvider: REAL
           MasterStackTraceElementAnalyzer: DEFINED
                     MessageBindingFactory: DEFINED
                           MetaDataLocator: DEFINED
                                MetaWorker: DEFINED
           NullFieldStrategyBindingFactory: DEFINED
                   NullFieldStrategySource: DEFINED
                  NumericTranslatorSupport: DEFINED
                            ObjectRenderer: DEFINED
            PageActivationContextCollector: DEFINED
                             PageActivator: DEFINED
                   PageContentTypeAnalyzer: DEFINED
                     PageDocumentGenerator: DEFINED
                        PageElementFactory: DEFINED
                                PageLoader: DEFINED
                        PageMarkupRenderer: DEFINED
                      PageRenderLinkSource: DEFINED
                 PageRenderLinkTransformer: DEFINED
                           PageRenderQueue: DEFINED
                  PageRenderRequestHandler: DEFINED
                      PageResponseRenderer: DEFINED
                                PageSource: DEFINED
                     PartialMarkupRenderer: DEFINED
                          PeriodicExecutor: DEFINED
                    PersistentFieldManager: DEFINED
                          PersistentLocale: DEFINED
                          PerthreadManager: BUILTIN
                           PipelineBuilder: REAL
                       PlasticProxyFactory: BUILTIN
                        PropBindingFactory: DEFINED
                      PropertiesFileParser: DEFINED
                            PropertyAccess: VIRTUAL
                     PropertyConduitSource: DEFINED
                     PropertyShadowBuilder: VIRTUAL
                       RegistryShutdownHub: BUILTIN
                           RegistryStartup: REAL
                             RenderSupport: DEFINED
                                   Request: VIRTUAL
                   RequestExceptionHandler: DEFINED
                            RequestGlobals: DEFINED
                            RequestHandler: DEFINED
                          RequestPageCache: DEFINED
                    RequestSecurityManager: DEFINED
                     ResourceChangeTracker: DEFINED
                   ResourceDigestGenerator: DEFINED
                     ResourceDigestManager: DEFINED
                         ResourceMinimizer: DEFINED
                          ResourceStreamer: DEFINED
                                  Response: VIRTUAL
               ResponseCompressionAnalyzer: DEFINED
                          ResponseRenderer: DEFINED
                        SelectModelFactory: DEFINED
                 ServiceActivityScoreboard: BUILTIN
                    ServiceLifecycleSource: REAL
                           ServiceOverride: REAL
             ServletApplicationInitializer: REAL
SessionApplicationStatePersistenceStrategy: DEFINED
                            SessionFactory: DEFINED
            SessionPersistedObjectAnalyzer: DEFINED
                           StrategyBuilder: VIRTUAL
                  StreamableResourceSource: DEFINED
                            StringInterner: DEFINED
                      SymbolBindingFactory: DEFINED
                              SymbolSource: REAL
                            TemplateParser: DEFINED
                              ThreadLocale: DEFINED
                              ThunkCreator: DEFINED
                              TimingFilter: DEFINED
                   TranslateBindingFactory: DEFINED
                TranslatorAlternatesSource: DEFINED
                          TranslatorSource: DEFINED
                               TypeCoercer: REAL
                                URLEncoder: DEFINED
                         UpdateListenerHub: DEFINED
                    ValidateBindingFactory: DEFINED
             ValidationConstraintGenerator: DEFINED
                ValidationDecoratorFactory: DEFINED
                            ValidatorMacro: DEFINED
                        ValueEncoderSource: DEFINED

86.70% unrealized services (163/188)

Application 'app' (version 1.0-SNAPSHOT-DEV) startup time: 225 ms to build IoC Registry, 927 ms overall.

 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3-beta-20 (development mode)


2011-10-13 10:56:46.321::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server


From http://tapestryjava.blogspot.com/2011/10/tapestry-53-maven-archetype.html

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}