如何增加 Ant“Javadoc”的内存?任务?

发布于 2024-09-26 11:57:16 字数 1206 浏览 2 评论 0原文

创建 ant 构建脚本来生成 Javadoc 时,Eclipse 收到 OutOfMemoryError。 ant 构建在运行配置的 JRE 选项卡下具有 -Xmx512m 和 -Xms512m 设置。 这对于编译应用程序非常有用。 唯一的问题是构建的 Javadoc 部分。这是 build.xml 文件

<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>

当构建脚本运行时,我看到一个两步过程, Eclipse 启动

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

Visual VM 显示该进程使用上面列出的堆内存参数启动。 然后,该进程生成第二个进程“JavaDoc”,并且 VM 参数不会随之传递。 在 VisualVM 中,可以确认 JavaDoc 进程在抛出 OOM 错误之前具有默认的 -Xms8m 值和大约 64m Xmx 值。

在 Eclipse 中的 Ant 首选项下,我尝试添加一个“ANT_OPTS”变量以将 JVM 参数传递给 JavaDoc。 改变并没有奏效。

如果我创建批处理文件并设置 ANT_OPTS 值,则构建确实有效。

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

但创建批处理文件违背了允许我直接在 Eclipse 中构建所有内容的目的。

我还尝试在构建文件中添加 an ,这将硬编码堆大小

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

知道如何设置该值以便我的 javadoc 将生成更多的堆大小吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪痕残 2024-10-03 11:57:16

javadoc 任务 具有用于指定此值的属性 maxmemory 。允许您单独调整此任务。

The javadoc task has the attribute maxmemory for specifying this. Allows you to separately tune for this task.

不知在何时 2024-10-03 11:57:16

值得注意的是,显然您可以出于另一个原因在 javadoc 上获得 OOME:请参阅其他问题: ant 内存不足错误

It is worth noting that apparently you can get an OOME on javadoc for another reason: see that other question : Out of memory error in ant

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文