You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2005/10/23 22:45:10 UTC

[DAISY] Created: Cocoon's Mavenization

A new document has been created.

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

Document ID: 756
Branch: main
Language: default
Name: Cocoon's Mavenization
Document Type: Cocoon Document
Created: 10/23/05 8:44:49 PM
Creator (owner): Jorg Heymans
State: publish

Parts
=====

Content
-------
Mime type: text/xml
Size: 4132 bytes
Content:
<html>
<body>

<h1>Welcome to Cocoon 2.2's Mavenization Page</h1>

<p>(Note : the maven build of cocoon is hereafter referred to as M10N)</p>

<h2>Status</h2>

<ul>
<li>core and all blocks are under pom control, ie all have a pom.xml with
correct dependencies. This means that cocoon is compileable and jar-able with
maven <strong>today</strong>.</li>
<li>pom include &lt;testSourceDirectory/&gt; directives, which means you can run
tests</li>
<li>webapp pom is defined</li>
<li>cocoon "master" pom is defined with all modules</li>
</ul>

<h2>Current Structure</h2>

<p>/repository-root<br/>
       <strong>pom.xml  </strong>-&gt; defines all modules <br/>
/core<br/>
            <strong>pom.xml  </strong>-&gt; cocoon-core definition<br/>
     /webapp<br/>
            <strong>pom.xml</strong>    -&gt; webapp definition<br/>
     /src/blocks<br/>
                    /apples<br/>
                          <strong>pom.xml   </strong>-&gt; block definition
<br/>
                   /authentication-fw<br/>
                          <strong>pom.xml</strong></p>

<h2>Good to know if you want to try out M10N</h2>

<p>Below commands always execute using pom.xml in the current directory, unless
otherwise specified. Thus if you execute it in the repository root where the
master pom.xml is defined, maven will subsequently run the goal for all blocks.
</p>

<h5>compile a module</h5>

<p><tt>$mvn compile</tt></p>

<h5>package a module</h5>

<p><tt>$mvn package</tt></p>

<h5>install a module in the local repository (meaning its definition can be
reused by your other modules)</h5>

<p><tt>$mvn install</tt></p>

<h5>switch-off testing</h5>

<p>maven by default runs tests, use  <tt>-Dmaven.test.skip=true </tt>to disable
them</p>

<h5>build offline</h5>

<p><tt>$mvn -o &lt;yourgoalhere&gt;</tt></p>

<h5>show stacktraces</h5>

<p><tt>$mvn -e &lt;yourgoalhere&gt;</tt></p>

<h2>How to add a new dependency to an existing module</h2>

<p>There are two possibilities here : the new dependency is already using maven,
or it is not.</p>

<h3>The new dependency uses maven</h3>

<p>Say you would like to add a dependency to cglib v2.1. From the
<a href="http://ibiblio.org/maven2/">central repository</a> , you found out that
it's already being deployed there with maven descriptors and everything. All you
need to do at this point is add the following to pom.xml of the module</p>

<p><tt>&lt;dependency&gt;<br/>
      &lt;groupId&gt;cglib&lt;/groupId&gt;  ---&gt; corresponds to the name of
the directory under URL above<br/>
      &lt;artifactId&gt;cglib&lt;/artifactId&gt;   ---&gt; corresponds to the
subdirectory of the groupId, which in this case is the same<br/>
      &lt;version&gt;2.1&lt;/version&gt;<br/>
&lt;/dependency&gt;</tt></p>

<p>The next goal execution will trigger a download of this module with all its
dependencies.</p>

<h3>The new dependency doesn't use maven (yet)</h3>

<p>Let us take the example of JDBI recently added by Sylvain. In order to make
it useable for us in the maven build we need to do following steps</p>

<ol>
<li>go to the cvs.apache.org/repository directory on minotaur.</li>
<li>create a groupId directory, "jdbi"</li>
<li>create a subdirectory "jars"</li>
<li>copy the jar into this subdirectory, making sure it's named like
&lt;libraryname&gt;-&lt;version&gt;.jar so maven can reference it.</li>
<li>chmod -R 0775 jdbi , so others can make changes later as well.</li>
</ol>

<p>After this, you can go ahead and add the dependency to your cocoon block</p>

<p><tt> &lt;dependency&gt;<br/>
      &lt;groupId&gt;jdbigroupId&gt;  <br/>
      &lt;artifactId&gt;jdbi&lt;/artifactId&gt;   <br/>
      &lt;version&gt;3.0.1beta&lt;/version&gt;<br/>
&lt;/dependency&gt;<br/>
</tt><br/>
Now package your block again to verify that maven downloads the dependency
correctly.</p>

<p>Once you find out that the library is listed on ibiblio, you can remove it
from minotaur and adjust pom.xml to the new location.</p>

</body>
</html>

Collections
===========
The document belongs to the following collections: documentation