cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: Your first Cocoon application using Maven 2
Date Thu, 28 Dec 2006 17:44:02 GMT
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: 12/28/06 5:43:40 PM
Updated by: Reinhard Pötz

A new version has been created, state: publish

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 7081 bytes (previous version: 5902 bytes)
Content diff:
(3 equal lines skipped)
    <h1>Creating a Cocoon web application</h1>
    
    <p>First, make sure that you have Maven 2.0.4 or above installed. You can check
--- by calling</p>
+++ this by calling</p>
    
    <pre>mvn --version</pre>
    
--- <p>from command line.<br/>
--- If that works for you, 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>. Move into it and invoke the
+++ <p>from command line.</p>
+++ 
+++ <p>If that works for you, 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>. Change into it and invoke the
    <tt>cocoon-22-archetype-webapp</tt> archetype:</p>
    
    <pre>mvn archetype:create
(28 equal lines skipped)
    -DarchetypeArtifactId=cocoon-22-archetype-block -DarchetypeVersion=1.0.0-M4
    -DgroupId=com.mycompany -DartifactId=myBlock1</tt></p>
    
--- <p>Move into the myBlock1 directory and call</p>
+++ <p>Change into the <tt>myBlock1</tt> directory and call</p>
    
    <pre>mvn install</pre>
    
(18 equal lines skipped)
    
    <p>So far the web application <tt>myCocoonWebapp</tt> doesn't have any
    information about the existense of the block <tt>myBlock1</tt>. Change this
by
--- opening <tt>getting-started-app/myCocoonWebapp/pom.xml</tt>and add the block
as
+++ opening <tt>getting-started-app/myCocoonWebapp/pom.xml</tt> and add the block
as
    dependency:</p>
    
    <pre>&lt;project&gt;
      [...]
        &lt;dependencies&gt;
          &lt;dependency&gt;
---         &lt;groupId&gt;<strong><tt>com.mycompany</tt></strong>&lt;/groupId&gt;
+++ <strong>        &lt;groupId&gt;<strong><tt>com.mycompany</tt></strong>&lt;/groupId&gt;
            &lt;artifactId&gt;<strong>myBlock1</strong>&lt;/artifactId&gt;
---         &lt;version&gt;<strong>1.0-SNAPSHOT</strong>&lt;/version&gt;
+++         &lt;version&gt;<strong>1.0-SNAPSHOT</strong>&lt;/version&gt;</strong>
          &lt;/dependency&gt;
        &lt;/dependencies&gt;
      [...]
(16 equal lines skipped)
    <p>For your convenience you can create a parent pom for the two Maven modules.
    Create a file <tt>getting-started-app/pom.xml</tt> with following content:</p>
    
--- <pre>&lt;project&gt;
---   &lt;name&gt;Cocoon Getting Stared application [parent]application&lt;/name&gt;
---   TBD
+++ <pre>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
+++  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+++  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
+++ 
+++   &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
+++   &lt;packaging&gt;pom&lt;/packaging&gt;
+++   
+++   &lt;groupId&gt;com.mycompany&lt;/groupId&gt;
+++   &lt;artifactId&gt;getting-started-app&lt;/artifactId&gt;
+++   &lt;version&gt;1-SNAPSHOT&lt;/version&gt;
+++   
+++   &lt;name&gt;Cocoon Getting Stared application [parent]&lt;/name&gt;
+++   
      &lt;modules&gt;
---  &lt;module&gt;<strong>myWebapp</strong>&lt;/module&gt;<strong>
---     &lt;</strong>module&gt;<strong>myBlock1</strong>&lt;/module&gt;
+++     &lt;module&gt;<strong>myWebapp</strong>&lt;/module&gt;
+++     &lt;module&gt;<strong>myBlock1</strong>&lt;/module&gt;
      &lt;/modules&gt;
    &lt;/project&gt;
    </pre>
(3 equal lines skipped)
    webapp and the block. Maven also takes care that the modules are build,
    according to the dependency graph, in the correct order.</p>
    
+++ <p>If you want to inherit information (e.g. plugin configurations, properties,
+++ etc.) from the new parent pom to the two modules, you have to add the parent
+++ element to <tt>getting-started-app/myCocoonWebapp/pom.xml</tt> and
+++ <tt>getting-started-app/myBlock1/pom.xml</tt>:</p>
+++ 
+++ <pre>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
+++  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+++  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
+++ 
+++   [...]
+++   &lt;parent&gt;
+++     &lt;groupId&gt;com.mycompany&lt;/groupId&gt;
+++     &lt;artifactId&gt;getting-started-app&lt;/artifactId&gt;
+++     &lt;version&gt;1-SNAPSHOT&lt;/version&gt;
+++   &lt;/parent&gt;
+++   [...]
+++ 
+++ &lt;/project&gt;</pre>
+++ 
    <h1>Conclusion and further information</h1>
    
    <p>So far you have created a Cocoon application that consists of a web
(40 equal lines skipped)


Mime
View raw message