Skip to content

Steve Hill

Why Am I Getting an OutOfMemoryError with my Ant Task?

java, build1 min read

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

1ant publish-interesting-artifact

After

1ANT_OPTS=Xmx1g ant publish-interesting-artifact