This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 51372 - Javadoc Ant-Task fails with large projects (a lot of sub-projects)
Summary: Javadoc Ant-Task fails with large projects (a lot of sub-projects)
Status: RESOLVED DUPLICATE of bug 57375
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Tomas Zezula
URL: http://issues.apache.org/bugzilla/sho...
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-10 11:02 UTC by arittner
Modified: 2005-10-17 16:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description arittner 2004-11-10 11:02:11 UTC
On large projects with many subprojects and
libraries the ant task fails with:

Generating Javadoc
Javadoc execution
C:\Entw\Work\projects\Sepix\S3\nbproject\build-impl.xml:347:
Javadoc failed: java.io.IOException:
CreateProcess: C:\Entw\JDK\1.4.2\bin\javadoc.exe
-d C:\Entw\Work\projects\Sepix\S3\dist\javadoc
-use -splitindex -classpath
C:\Entw\Work\projects\Sepix\sXcore\dist\sXcore.jar;C:\Entw\Work\projects\Sepix\sXoffice\dist\sXoffice.jar;C:\Entw\Work\projects\Sepix\sXdbstubs\dist\sXdbstubs.jar;C:\Entw\Work\projects\Sepix\sXarchiver\dist\sXarchiver.jar;C:\Entw\Work\projects\Sepix\sXlogger\dist\sXlogger.jar;C:\Entw\Work\projects\Sepix\sXgui\dist\sXgui.jar;C:\Entw\Work\projects\Sepix\sXinput\dist\sXinput.jar;C:\Entw\Work\projects\Sepix\sXreflect\dist\sXreflect.jar;C:\Entw\Work\projects\Sepix\libs\jni\izmcomjni.jar;C:\Entw\Work\projects\Sepix\libs\chart\jfreechart-0.9.21.jar;C:\Entw\Work\projects\Sepix\libs\common\log4j-1.2.8.jar;C:\Entw\Work\projects\Sepix\libs\common\jcommon-0.9.6.jar;C:\Entw\Work\projects\Sepix\libs\deprecated\ElixirReport-Lite.jar;C:\Entw\Work\projects\Sepix\libs\deprecated\interclient.jar;C:\Entw\Work\projects\Sepix\libs\gui\AbsoluteLayout.jar;C:\Entw\Work\projects\Sepix\libs\gui\icons.jar;C:\Entw\W”
BUILD FAILED (total time: 0 seconds)

The target from a project created in beta2:

    <target name="-javadoc-build" depends="init">
        <mkdir dir="${dist.javadoc.dir}"/>
        <javadoc destdir="${dist.javadoc.dir}"
source="${javac.source}"
notree="${javadoc.notree}" use="${javadoc.use}"
nonavbar="${javadoc.nonavbar}"
noindex="${javadoc.noindex}"
splitindex="${javadoc.splitindex}"
author="${javadoc.author}"
version="${javadoc.version}"
windowtitle="${javadoc.windowtitle}"
private="${javadoc.private}" failonerror="true">
            <classpath>
                <path path="${javac.classpath}"/>
            </classpath>
            <sourcepath>
                <pathelement location="${src.dir}"/>
            </sourcepath>
            <fileset dir="${src.dir}"/>
        </javadoc>
    </target>

regards,
  josh.
Comment 1 arittner 2004-11-10 11:18:55 UTC
And here is the fix ;-)

    <target name="-javadoc-build" depends="init">
        <mkdir dir="${dist.javadoc.dir}"/>
        <javadoc destdir="${dist.javadoc.dir}" 
                 source="${javac.source}" 
                 notree="${javadoc.notree}" 
                 use="${javadoc.use}" 
                 nonavbar="${javadoc.nonavbar}" 
                 noindex="${javadoc.noindex}" 
                 splitindex="${javadoc.splitindex}" 
                 author="${javadoc.author}" 
                 version="${javadoc.version}" 
                 windowtitle="${javadoc.windowtitle}" 
                 private="${javadoc.private}" 
                 failonerror="true"
                 useexternalfile="yes">
            <classpath>
                <path path="${javac.classpath}"/>
            </classpath>
            <sourcepath>
                <pathelement location="${src.dir}"/>
            </sourcepath>
            <fileset dir="${src.dir}"/>
        </javadoc>
    </target>

The task needs the option useexternalfile="yes" to prevent large
command line arguments.

Ant documentation from
http://ant.apache.org/manual/CoreTasks/javadoc.html:

useexternalfile (1.2+)

indicates whether the sourcefile name specified in srcfiles or as
nested source elements should be written to a temporary file to make
the command line shorter. Also applies to the package names specified
via the packagenames attribute or nested package elements. (yes | no).
Default is no.


regards,
  josh.
Comment 2 psuk 2004-11-10 13:24:41 UTC
Moving to "projects" category for evaluation
Comment 3 David Konecny 2004-11-10 13:37:19 UTC
Thanks for the fix. I will apply it for 4.1.
Comment 4 Jesse Glick 2004-11-10 20:44:47 UTC
Does useexternalfile="yes" handle also the long classpath? (Docs do
not mention that, if so - Ant doc bug?) You (reporter) specifically
tested this change and it fixes the problem in your case?
Comment 5 arittner 2004-11-11 08:22:56 UTC
IMHO the "useexternalfile" invokes the javadoc with:

javadoc @argfile

and @argfile ist the temporary external file.

Here is the documantation from sun:

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#argumentfiles

"To shorten or simplify the javadoc command line, you can specify one
or more files that themselves contain arguments to the javadoc command
(except -J options). This enables you to create javadoc commands of
any length on any operating system." 
[...]
"Example - Single Arg File
You could use a single argument file named "argfile" to hold all
Javadoc arguments:
  C:> javadoc @argfile"

And yes, my very (very) long classpath works with the option
"useexternalfile". IMHO it's a ant doc bug.

Ok, a closer look to the ant source
(http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=1.124.2.5&view=markup)

 /**
  * Write sourcefiles and package names to a temporary file
  * if requested.
  */
  if (useExternalFile) {
    if (tmpList == null) {
      tmpList = fileUtils.createTempFile("javadoc", "", null);
      tmpList.deleteOnExit();
      toExecute.createArgument()
        .setValue("@" + tmpList.getAbsolutePath());
    }
    srcListWriter = new PrintWriter(
      new FileWriter(tmpList.getAbsolutePath(), true));
  }

useexternalfile definitely use the @external file. It's a ant-doc-bug.
And the option works fine for the netbeans build file.

regards,
  josh.



Comment 6 arittner 2004-11-11 08:36:03 UTC
I've added some comments to
http://issues.apache.org/bugzilla/show_bug.cgi?id=30410
Comment 7 David Konecny 2004-12-01 16:08:32 UTC
I just wanted to fix this but I discovered different problem which is
filed as <http://issues.apache.org/bugzilla/show_bug.cgi?id=27814> in
Ant issuezilla. Till it is fixed I will not implement this issue
because it breaks Javadoc generation completely on my WinXP.

I'm curious how it can work for you Aljoscha?

The problem is really in JDK's javadoc executable and I'm going to
file bug against it and will attach it both here in in Ant's issue.
Comment 8 David Konecny 2004-12-02 12:13:29 UTC
JDK issue: <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6202474>
Comment 9 Jesse Glick 2004-12-02 16:06:21 UTC
Is it really a bug in the JDK that it interprets \ inside a string
like the Java language does? IMHO just absent documentation. Perhaps
Ant should be doubling \ in this situation?
Comment 10 David Konecny 2004-12-02 16:12:19 UTC
Yes, perhaps it is just lack of documentation and patch in Ant
issuezilla suggests exactly that solution. On the other hand it seems
to me strange to force me on Win platform to escape all backslashes in
my arguments file just because Java language does that. And btw.
StreamTokenizer (which is used to read the arguments file) interpret
backslash as escape *only* when inside quot. So if your path do not
contain spaces then you do not have to quot it and in that case you do
not have to escape all backslashes.
Comment 11 Jesse Glick 2005-04-01 00:10:26 UTC
FYI - Ant #27814 fixed in Ant dev trunk.
Comment 12 Jesse Glick 2005-05-31 17:32:23 UTC
Can take advantage of fix in Ant. Should be available in 1.6.5.
Comment 13 Tomas Zezula 2005-10-17 16:32:43 UTC

*** This issue has been marked as a duplicate of 57375 ***