Why Am I Getting an OutOfMemoryError with my Ant Task?

April 21, 2012

Say you’re uploading a fully contained artifact to artifactory. The size of the archive is pushing 35mb and your chosen Ant task is throwing the dreaded OutOfMemoryError.

Why?

Many Ant tasks work by forking the JVM. The default size of the forked JVM may well need to be increased. To test this theory, increase it to something reasonable by including ANT_OPTS.

Before

ant publish-interesting-artifact

After

ANT_OPTS=Xmx1g ant publish-interesting-artifact

Profile picture

Written by @sghill, who works on build, automated change, and continuous integration systems.