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.


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.


ant publish-interesting-artifact


ANT_OPTS=Xmx1g ant publish-interesting-artifact

Profile picture

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