Why Am I Getting an OutOfMemoryError with my Ant Task?

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

Published Apr 21, 2012