title: Difference between ANT task maxmemory and setting heap size via jvmarg?
body: <p>I am getting heap exceptions during testing:</p>
  
  <pre><code>[junit] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  </code></pre>
  
  <p>I have read about <a href="https://stackoverflow.com/questions/25039864/specifying-jvm-arguments-in-ant-tasks">multiple</a> solutions to this problem, but I am confused as to which is the actual correct method. In the ANT task, there is the option e.g.:</p>
  
  <pre><code>&lt;junit fork="true" haltonfailure="no" maxmemory="1024m"&gt;
  </code></pre>
  
  <p>And others have recommended passing arguments via ANT_OPTS or via the task e.g.:</p>
  
  <pre><code>&lt;jvmarg value="-Xmx1024M"&gt;
  </code></pre>
  
  <p>Would it be redundant to set both of these values? If not, which is the recommended method?</p>