MavenTipsAndTricks has been created by Bertrand Delacretaz (May 14, 2008).

Content:

Here's our collection of tips and tricks for building Sling with Maven.

Maven settings

Ignore your local settings

To make sure you're getting the same results as we are when building Sling, it is recommend to disable any local settings.

On unixish platforms, using

mvn -s /dev/null ...

does the trick.


Does anyone have a similar command-line option that works under Windows?

MAVEN_OPTS

The MAVEN_OPTS environment variable defines options for the JVM that executes Maven.

Set it according to your platform, i.e. export MAVEN_OPTS=... on unixish systems or set MAVEN_OPTS=... on Windows.

Increase JVM memory if needed

If getting an OutOfMemoryException when running mvn, try setting

MAVEN_OPTS="-Xmx256M"

to allocate 256MB of RAM to Maven.

Debugging code launched by Maven

To run the Sling launchpad webapp in debug mode from Maven, for example, use something like

MAVEN_OPTS="-Dcom.sun.management.jmxremote -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n"

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

Reply via email to