[DAISY] Updated: Your first Cocoon application using Maven 2

[email protected]
Newsgroups gmane.text.xml.cocoon.documentation
Message-ID <[email protected]>
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1159.html

Document ID: 1159
Branch: main
Language: default
Name: Your first Cocoon application using Maven 2 (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 6/21/08 12:08:44 AM
Updated by: David Legg

A new version has been created, state: draft

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 8196 bytes (previous version: 6449 bytes)
Content diff:
    <html>
    <body>
    
--- <h1>Creating a Cocoon block</h1>
--- 
    <p>In this tutorial, you will:</p>
    
    <ol>
(2 equal lines skipped)
    <li>Start the block as a web application and access it from your browser</li>
    </ol>
    
--- <p class="note">First, make sure that you have Maven 2.0.9 or above installed.
+++ <p class="note">First, make sure that you have Maven 2.0.8 or above installed.
    You can check this by calling mvn --version from the command line. If this
    doesn't work for you, read the
    <a href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">Maven
    in 5 Minutes</a> tutorial.</p>
    
+++ <h1>Creating a Cocoon block</h1>
+++ 
    <p>Create a new directory which will be the root directory of your Cocoon
--- application. For this tutorial, let's name it <tt>getting-started-app</tt>.</p>
+++ application and change into it. For this tutorial, let's name it
+++ <tt>getting-started-app</tt>.</p>
    
    <p>The next step is to create a Cocoon block to contain your custom application.
--- The development of any Cocoon web application should be done within a block.</p>
+++ The development of any Cocoon web application should be done within a block.  A
+++ Cocoon block is little different to any other kind of Maven block.  It simply
+++ has a particular <a href="daisy:1263">directory and file structure</a>.</p>
    
--- <p>We could manually create the necessary file and folder structure of the
--- block, but a simpler route is to use Maven's 'archetype' plugin.  This allows us
--- to select the kind of block we desire from a list and have Maven do the work. 
--- The default list of archetypes is quite large so , for convenience, a catalog of
--- Cocoon archetypes has been posted on the Cocoon web site
--- (<a href="http://cocoon.apache.org/archetype-catalog.xml">http://cocoon.apache.org/archetype-catalog.xml</a>)
--- and we shall make use of it as follows: -</p>
+++ <p>We could manually create the block, but a simpler route is to use Maven's
+++ 'archetype' plugin.  This allows us to select from a list of block types and
+++ have Maven create them for us.  The default list of archetypes is quite large. 
+++ For convenience, a catalog of Cocoon archetypes is available on the Cocoon web
+++ site and we shall use that.</p>
    
--- <pre>mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org/archetype-catalog.xml
---   -DarchetypeArtifactId=cocoon-22-archetype-block
---   -DarchetypeVersion=1.0.0
---   -DgroupId=com.mycompany
---   -DartifactId=myBlock1 
+++ <p class="note">The current version of the Archetype plugin (2.0 alpha-3) has a
+++ bug which prevents it accessing the remote copy of the Cocoon archetype
+++ catalog.  The following instructions will be simpler when this is fixed.</p>
+++ 
+++ <p>First save the catalog somewhere convenient.  In Windows you could open a
+++ browser on
+++ <a href="http://cocoon.apache.org/archetype-catalog.xml">http://cocoon.apache.org/archetype-catalog.xml</a>
+++ and save it from there.</p>
+++ 
+++ <p>In Unix you could execute the command: -</p>
+++ 
+++ <pre>wget http://cocoon.apache.org/archetype-catalog.xml
    </pre>
    
--- <p class="note">Once again for copy and paste without line feeds:<br/>
--- <tt>mvn archetype:create -DarchetypeGroupId=org.apache.cocoon
--- -DarchetypeArtifactId=cocoon-22-archetype-block -DarchetypeVersion=1.0.0
--- -DgroupId=com.mycompany -DartifactId=myBlock1</tt></p>
+++ <p>Now run the following Maven command and when requested type in the answers
+++ (shown in bold): -</p>
    
+++ <pre>&gt; <strong>mvn archetype:generate -DarchetypeCatalog=file://archetype-catalog.xml</strong>
+++ [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] [archetype:generate]
+++ [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: local -&gt; cocoon-22-archetype-block-plain (Creates an empty Cocoon block; useful if you want to add another block to a Cocoon application)
+++ 2: local -&gt; cocoon-22-archetype-block (Creates a Cocoon block containing some small samples)
+++ 3: local -&gt; cocoon-22-archetype-webapp (Creates a web application configured to host Cocoon blocks. Just add the block dependencies)
+++ Choose a number:  (1/2/3): <strong>2</strong>
+++ Define value for groupId: : <strong>com.mycompany</strong>
+++ Define value for artifactId: : <strong>myBlock1</strong>
+++ Define value for version:  1.0-SNAPSHOT: : <strong>1.0.0</strong>
+++ Define value for package: : <strong>com.mycompany.myBlock1</strong>
+++ ...
+++  Y: : <strong>y</strong>
+++ ...
+++ [INFO] ------------------------------------------------------------------------
+++ [INFO] BUILD SUCCESSFUL
+++ [INFO] ------------------------------------------------------------------------
+++ 
+++ </pre>
+++ 
    <p class="note">If you are using a cocoon binary build from svn trunk then you
    probably want to change the archetypeVersion to the most recent one, matching
    the svn trunk. (see
(103 equal lines skipped)


Links
=====
Added link:
   Title: Block structure
   Target: daisy:1263
Added link:
   Title: Archetype catalog of Cocoon archetypes
   Target: http://cocoon.apache.org/archetype-catalog.xml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.