views:

24

answers:

1

When creating an ant build script to generate Javadoc, Eclipse is receiving an OutOfMemoryError. The ant build has the -Xmx512m and -Xms512m settings under the JRE tab in the run configuration. This works great for compiling the application. The only trouble is with the Javadoc portion of the build. Here is the build.xml file

<target name="JavaDoc" description="Create Javadocs">
    <javadoc destdir="c:/javadoc" windowtitle="My API">
        <classpath refid="application.classpath" />
        <packageset dir="Source">
            <include name="**" />
        </packageset>
    </javadoc>
</target>

When the build script runs I see a 2 step process, Eclipse launches

org.eclipse.ant.internal.ui.antsupport.InternalAntRunner

Visual VM shows that this process launches with the Heap memory arguments listed above. This process then spawns the 2nd process "JavaDoc" and the VM arguments are not passed along with it. In VisualVM it can be confirmed that the JavaDoc process has a default -Xms8m value and around a 64m Xmx value before the OOM error is thrown.

Under the Ant preferences in Eclipse I have attempted to add an ANT_OPTS variable to pass the JVM args to JavaDoc. The change did not work.

The build does work if I create a batch file and set the ANT_OPTS values.

set ANT_OPTS=-Xms512m -Xmx512m
ant -file C:\myApp\build.xml JavaDoc

But creating the batch file is defeating the purpose of allowing me to build everything directly in Eclipse.

I have also tried adding an to the build file, which would hardcode a heap size

<arg value="ANT_OPTS=-Xms512m -Xmx512m" />

Any idea how to set the value so my javadoc will spawn with more heap size?

A: 

The javadoc task supports a maxmemory attribute - have you tried that?

martin clayton
Thanks, that did work, I see my Xmx at the proper value now. Missed that parameter when I was reading the API. will accept answer shortly
Sean