incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > MavenTipsAndTricks
Date Thu, 02 Jun 2011 13:55:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&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/SLINGxSITE/MavenTipsAndTricks">MavenTipsAndTricks</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~fmeschbe">Felix
Meschberger</a>
    </h4>
        <br/>
                         <h4>Changes (3)</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" > <br>{noformat} <br></td></tr>
            <tr><td class="diff-changed-lines" >MAVEN_OPTS=&quot;-Xmx256M
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-XX:MaxPermSize=128m&quot;</span>
<span class="diff-added-words"style="background-color: #dfd;">-XX:MaxPermSize=256m&quot;</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{noformat} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">MAVEN_OPTS=&quot;-Dcom.sun.management.jmxremote
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n&quot;
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">MAVEN_OPTS=&quot;-agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n&quot;
<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Here's our collection of tips and tricks for building Sling with <a href="http://maven.apache.org"
class="external-link" rel="nofollow">Maven</a>.</p>

<h1><a name="MavenTipsAndTricks-Mavenlocalrepository"></a>Maven local repository</h1>

<p>The first time you run a Maven build, or when Maven needs additional build components,
it downloads plugins and dependencies under its <em>local repository</em> folder
on your computer. By default, this folder is named <em>.m2/repository</em> in
your home directory.</p>

<p>Maven uses this repository as a cache for artifacts that it might need for future
builds, which means that the first Sling build usually takes much longer than usual, as Maven
needs to download many tools and dependencies into its local repository while the build progresses.</p>

<p>The build might fail if one of those downloads fails, in that case it might be worth
retrying the build, to check if that was just a temporary connection problem, or if there's
a more serious error.</p>

<p>In some cases, the local Maven repository might get corrupted - if your build fails
on a computer and works on another one, clearing the local repository before restarting the
build might be worth trying.</p>

<h1><a name="MavenTipsAndTricks-Mavensettings"></a>Maven settings</h1>

<h2><a name="MavenTipsAndTricks-Ignoreyourlocalsettings"></a>Ignore your
local settings</h2>
<p>To make sure you're getting the same results as we are when building Sling, it is
recommend to ignore any local settings.</p>

<p>On unixish platforms, using</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn -s /dev/null ...
</pre>
</div></div>

<p>does the trick.</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>Does anyone have a similar command-line
option that works under Windows?</td></tr></table></div>

<h1><a name="MavenTipsAndTricks-"></a></h1>
<h1><a name="MavenTipsAndTricks-MAVENOPTS"></a>MAVEN_OPTS</h1>
<p>The MAVEN_OPTS environment variable defines options for the JVM that executes Maven.</p>

<p>Set it according to your platform, i.e. <tt>export MAVEN_OPTS=...</tt>
on unixish systems or <tt>set MAVEN_OPTS=...</tt> on Windows.</p>

<h2><a name="MavenTipsAndTricks-IncreaseJVMmemoryifneeded"></a>Increase
JVM memory if needed</h2>
<p>If getting an OutOfMemoryException when running mvn, try setting</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=256m"
</pre>
</div></div>

<p>to allocate 256MB of RAM to Maven.</p>

<h2><a name="MavenTipsAndTricks-DebuggingcodelaunchedbyMaven"></a>Debugging
code launched by Maven</h2>
<p>To run the Sling launchpad webapp in debug mode from Maven, for example, use something
like</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>MAVEN_OPTS="-agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n"
</pre>
</div></div>

<p>And then connect to port 30303 with a remote JVM debugger (most IDEs do this).</p>

<h2><a name="MavenTipsAndTricks-AvoidspacesinMavenrepositoryandworkspacepaths"></a>Avoid
spaces in Maven repository and workspace paths</h2>
<p>Some Maven plugins do not like spaces in paths. It is better to avoid putting your
Maven repository, or your code, under paths like <em>Documents and Settings</em>,
for example.</p>
    </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/SLINGxSITE/MavenTipsAndTricks">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=85717&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/MavenTipsAndTricks?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message