geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Building Geronimo with Maven
Date Thu, 23 Jun 2011 06:18:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Building+Geronimo+with+Maven">Building
Geronimo with Maven</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~chirunhua@gmail.com">Runhua
Chi</a>
    </h4>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" ># Increase the heap and max permanent
size for Maven <br>if [ &quot;x$MAVEN_OPTS&quot; = &quot;x&quot; ];
then <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
   MAVEN_OPTS=&quot;-Xmx512m -XX:PermSize=64m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=64m&quot;
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
   MAVEN_OPTS=&quot;-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=64m&quot;
<br></td></tr>
            <tr><td class="diff-unchanged" >fi <br>{noformat} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >h2. Troubleshooting <span class="diff-added-words"style="background-color:
#dfd;">and Tips</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>* Use -DskipTests=true to turn off tests during server build. <br>* Use -o
to avoid searching remote repository. <br>* Use -X to produce maven debug information.
<br>* Build all Geronimo dependencies to avoid out-of-date code among projects such
as openEJB, JSF and so on. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <div>
<ul>
    <li><a href='#BuildingGeronimowithMaven-Overview'>Overview</a></li>
    <li><a href='#BuildingGeronimowithMaven-Prerequisites'>Prerequisites</a></li>
<ul>
    <li><a href='#BuildingGeronimowithMaven-JavaDeveloperKit%28JDK%29'>Java Developer
Kit (JDK)</a></li>
    <li><a href='#BuildingGeronimowithMaven-ApacheMaven2'>Apache Maven 2</a></li>
    <li><a href='#BuildingGeronimowithMaven-Subversion'>Subversion</a></li>
</ul>
    <li><a href='#BuildingGeronimowithMaven-CheckoutGeronimo'>Checkout Geronimo</a></li>
    <li><a href='#BuildingGeronimowithMaven-PreparingtoBuildfortheFirstTime'>Preparing
to Build for the First Time</a></li>
    <li><a href='#BuildingGeronimowithMaven-Building'>Building</a></li>
<ul>
    <li><a href='#BuildingGeronimowithMaven-BuildingStages'>Building Stages</a></li>
</ul>
    <li><a href='#BuildingGeronimowithMaven-TestingtheAssembly'>Testing the Assembly</a></li>
    <li><a href='#BuildingGeronimowithMaven-IDESetup'>IDE Setup</a></li>
<ul>
    <li><a href='#BuildingGeronimowithMaven-IntellijIDEA'>Intellij IDEA</a></li>
    <li><a href='#BuildingGeronimowithMaven-Eclipse'>Eclipse</a></li>
</ul>
    <li><a href='#BuildingGeronimowithMaven-TroubleshootingandTips'>Troubleshooting
and Tips</a></li>
</ul></div>

<h2><a name="BuildingGeronimowithMaven-Overview"></a>Overview</h2>

<p>This documents how to build the Apache Geronimo Server project in command line.</p>

<p>This guide is intended to cover how to build the latest <tt>server/trunk</tt>,
though other newer branches should also follow similar instructions.  Server trees that use
the same basic build tooling include:</p>
<ul>
	<li><tt>server/trunk</tt></li>
	<li><tt>server/branches/1.2</tt></li>
	<li><tt>server/branches/2.0</tt></li>
	<li><tt>server/branches/2.1</tt></li>
	<li><tt>server/branches/2.2</tt></li>
</ul>


<h2><a name="BuildingGeronimowithMaven-Prerequisites"></a>Prerequisites</h2>


<h3><a name="BuildingGeronimowithMaven-JavaDeveloperKit%28JDK%29"></a>Java
Developer Kit (JDK)</h3>

<p>You will need a <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"
title="Java SE 1.6" class="external-link" rel="nofollow">JDK 6.0&#43; (Java SE 1.6.0+)</a>
or compatible JDK to build Apache Geronimo.  It is recommended you use SUN's implementation,
or something compatible like Apples implementation.  Other JDK vendors implementations may
work, but use at your own risk.</p>


<h3><a name="BuildingGeronimowithMaven-ApacheMaven2"></a>Apache Maven 2</h3>

<p>To execute the build process you need to have <a href="http://maven.apache.org"
class="external-link" rel="nofollow">Apache Maven</a> version <tt>2.2.1</tt>
(or newer) installed.</p>

<p>To check if your installation is working and you have the required minimum version
run:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -version
</pre>
</div></div>
<p>And it should produce something like:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>Maven version: 2.2.1
</pre>
</div></div>


<p>If you have an incompatible version the server build will probably fail with a message
complaining <img class="emoticon" src="/confluence/images/icons/emoticons/wink.gif" height="20"
width="20" align="absmiddle" alt="" border="0"/></p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>maven repository</b><br
/>Add the following to your settings.xml for maven so that you can avoid the redirect (and
hence avoid the bogus poms/jars) and get beyond compilation failure problem to build Geronimo
using maven. See this message for more details.
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>excerpt of setting.xml for maven</b></div><div
class="codeContent panelContent">
<pre class="code-xml">

...
   <span class="code-tag">&lt;mirrors&gt;</span>
       <span class="code-tag">&lt;mirror&gt;</span>
           <span class="code-tag">&lt;id&gt;</span>java.net<span class="code-tag">&lt;/id&gt;</span>
           <span class="code-tag">&lt;name&gt;</span>Mirror of https://maven-repository.dev.java.net/nonav/repository/<span
class="code-tag">&lt;/name&gt;</span>
           <span class="code-tag">&lt;url&gt;</span>http://download.java.net/maven/2/<span
class="code-tag">&lt;/url&gt;</span>
           <span class="code-tag">&lt;mirrorOf&gt;</span>java.net<span
class="code-tag">&lt;/mirrorOf&gt;</span>
       <span class="code-tag">&lt;/mirror&gt;</span>
   <span class="code-tag">&lt;/mirrors&gt;</span>
...
</pre>
</div></div></td></tr></table></div>


<h3><a name="BuildingGeronimowithMaven-Subversion"></a>Subversion</h3>

<p>To fetch the source code for the server, you will need to have a <a href="http://subversion.tigris.org/"
class="external-link" rel="nofollow">Subversion</a> client version 1.2 (or newer,
1.4 is recommended) installed.</p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Windows Tip</b><br
/>Windows users are <b>strongly encouraged</b> to change the M2 local repository
(the place where dependencies are downloaded) to a shorter path with no spaces, e.g. <tt>C:\.m2</tt>.

<p>Using a longer path may cause the build (and Geronimo itself) to behave very strangely
when it hits the 260 character limit for filenames on Windows.</p>

<p>In order to change the m2 local repository go to <tt>%USERPROFILE%\.m2</tt>
and edit or create <tt>settings.xml</tt> file to contain the following content:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>?&gt;</span>
<span class="code-tag">&lt;settings&gt;</span>
    <span class="code-tag">&lt;localRepository&gt;</span>C:\.m2<span
class="code-tag">&lt;/localRepository&gt;</span>
<span class="code-tag">&lt;/settings&gt;</span>
</pre>
</div></div></td></tr></table></div>

<h2><a name="BuildingGeronimowithMaven-CheckoutGeronimo"></a>Checkout Geronimo</h2>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>svn co https://svn.apache.org/repos/asf/geronimo/server/trunk server
</pre>
</div></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Tip</b><br />If
you are using Chinese system, please change your locale to en_US. Otherwise, the maven 2.0.7(or
below) can't parse Chinese characters.</td></tr></table></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Windows Tip</b><br
/>Windows users are <b>strongly encouraged</b> to checkout Geronimo into <tt>c:\g</tt>.

<p>Using a longer path may cause the build (and Geronimo itself) to behave very strangely
when it hits the 260 char limit for filenames on Windows.</p></td></tr></table></div>

<p>You can also use Git mirrors to checkout Geronimo source code, and make sure you
have a Git client installed before using the following command:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>git clone git://git.apache.org/geronimo server
</pre>
</div></div>

<h2><a name="BuildingGeronimowithMaven-PreparingtoBuildfortheFirstTime"></a>Preparing
to Build for the First Time</h2>

<p>Chances are you will need to increase the heap size for Maven.  Add the following
lines to <tt>&#126;/.mavenrc</tt>:</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>The following snips only set <tt>MAVEN_OPTS</tt>
if its not already set, so that you can override these values on the command line if needed.</td></tr></table></div>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre># Increase the heap size Maven
if [ "x$MAVEN_OPTS" = "x" ]; then
    MAVEN_OPTS=-Xmx512m
fi
</pre>
</div></div>
<p>If you are using the SUN JDK (or a JDK with compatible flags, like the Apple JDK),
you should also increase the maximum permanent size as well as the heap:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre># Increase the heap and max permanent size for Maven
if [ "x$MAVEN_OPTS" = "x" ]; then
    MAVEN_OPTS="-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=64m"
fi
</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Windows Tip</b><br
/>Windows users should create <tt>mavenrc_pre.bat</tt> under <tt>c:\documents
and settings\&lt;username&gt;\mavenrc_pre.bat</tt> or <tt>c:\mavenrc_pre.bat</tt>
depending on how the <tt>%HOME%</tt> property is set on your system.

<p>Variables will need to use the batch set syntax:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>set &lt;VARIABLE&gt;=&lt;VALUE&gt;
</pre>
</div></div></td></tr></table></div>

<h2><a name="BuildingGeronimowithMaven-Building"></a>Building</h2>

<p>To build all changes incrementally:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn install
</pre>
</div></div>
<p>To perform clean builds, which are sometimes needed after some changes to the source
tree:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn clean install
</pre>
</div></div>


<h3><a name="BuildingGeronimowithMaven-BuildingStages"></a>Building Stages</h3>

<p>In some cases you may need to build Geronimo in stages, such as when building OpenEJB
from source to pick up local changes.  Most users will not need to do this, but its documented
here for clarity.</p>

<p>To build modules, configs and maven-plugins:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn install -Dstage=bootstrap
</pre>
</div></div>
<p>To build plugins, configs, plugingroups and assemblies:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn install -Dstage=assemble
</pre>
</div></div>
<p>As mentioned, most users will not need to build Geronimo in stages.  But in some
cases, when bootstrapping new versions (when no artifacts are deployed into remote repositories
for the current version), then you <b>must</b> build the stages separately for
the <em>first</em> build and then for all builds afterwards, the staged build
is not necessary.</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>If you encounter errors downloading
dependencies from the ibiblio maven mirror, adding the following to your <tt>settings.xml</tt>
file may help avoid the problem:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;settings&gt;</span>
  <span class="code-tag"><span class="code-comment">&lt;!-- central repo repo1
is mirrored to ibiblio. explictly overriding that to be repo1 itself --&gt;</span></span>
    <span class="code-tag">&lt;mirrors&gt;</span>
        <span class="code-tag">&lt;mirror&gt;</span>
            <span class="code-tag">&lt;id&gt;</span>ibiblio.org<span
class="code-tag">&lt;/id&gt;</span>
            <span class="code-tag">&lt;name&gt;</span>Mirror of http://repo1.maven.org/maven2/<span
class="code-tag">&lt;/name&gt;</span>
            <span class="code-tag">&lt;url&gt;</span>http://repo1.maven.org/maven2<span
class="code-tag">&lt;/url&gt;</span>
            <span class="code-tag">&lt;mirrorOf&gt;</span>central<span
class="code-tag">&lt;/mirrorOf&gt;</span>
        <span class="code-tag">&lt;/mirror&gt;</span>
    <span class="code-tag">&lt;/mirrors&gt;</span>
<span class="code-tag">&lt;/settings&gt;</span>
</pre>
</div></div></td></tr></table></div>

<h2><a name="BuildingGeronimowithMaven-TestingtheAssembly"></a>Testing the
Assembly</h2>

<p>Once you have build the server fully, which will produce a number of <tt>zip</tt>
and <tt>tar.gz</tt> archives from the assembly modules, you can use the <tt>geronimo-maven-plugin</tt>
to start the server.  From the project root directory run:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -Ptools geronimo:start
</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Windows Tip</b><br
/>Windows users may need to specify an alternative <tt>installDirectory</tt>
to avoid long path problems:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -Ptools geronimo:start -DinstallDirectory=c:\g
</pre>
</div></div></td></tr></table></div>
<p>And to stop, either <tt>CTRL-C</tt> or from a separate terminal, from
the project root directory run:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -Ptools geronimo:stop
</pre>
</div></div>

<h2><a name="BuildingGeronimowithMaven-IDESetup"></a>IDE Setup</h2>

<p>The server project does not have any IDE files checked in, they are all generated
by Maven plugins.  Once you have checked out the server tree and built it once, you can generate
the project configuration files for your IDE.</p>

<h3><a name="BuildingGeronimowithMaven-IntellijIDEA"></a>Intellij IDEA</h3>

<p>For the basic IDEA configuration:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn idea:idea
</pre>
</div></div>
<p>To generate a configuration which includes dependency sources and javadocs:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -Pdefault,idea
</pre>
</div></div>

<h3><a name="BuildingGeronimowithMaven-Eclipse"></a>Eclipse</h3>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -Pdefault,makeeclipse
</pre>
</div></div>

<h2><a name="BuildingGeronimowithMaven-TroubleshootingandTips"></a>Troubleshooting
and Tips</h2>

<ul>
	<li>Use -DskipTests=true to turn off tests during server build.</li>
	<li>Use -o to avoid searching remote repository.</li>
	<li>Use -X to produce maven debug information.</li>
	<li>Build all Geronimo dependencies to avoid out-of-date code among projects such as
openEJB, JSF and so on.</li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Building+Geronimo+with+Maven">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645440&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Building+Geronimo+with+Maven?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message