Currently it seems there is no way to specify the exact executable used to implement <javadoc>. This can be a major problem if you want to run Ant on one JDK (e.g. 1.4.2) while generating Javadoc for a project using another JDK (e.g. 1.5.0 beta). For example, there is no way to make 1.4.2's javadoc tool handle 1.5 generic sources. (-bootclasspath is no help: this does not change where the classes for the tool itself are loaded from.) Without this patch, it is thus impossible to make <javadoc> generate Javadoc for 1.5 generic sources when running Ant itself on a 1.4 or earlier VM. You need to use <exec> or <apply> or similar, which of course loses all the readability and error-checking of the normal task. Provides some parity with the 'executable' attribute of <javac>. Patch was lightly tested on Linux using 1.4.2 vs. 1.5.0 b62; seems to work as desired. Note that whatever bits of logic disable certain flags that are not supported by the "current" Javadoc version, will not be accurate if using an explicit executable. I think in practice this would not be a problem; the user would need to not attempt to set optional attributes (or nested elements) on <javadoc> that might not work in the target Javadoc version. Impact on NetBeans IDE 4.0: http://www.netbeans.org/issues/show_bug.cgi?id=46901
Created attachment 12397 [details] Suggested patch
*** Bug 22244 has been marked as a duplicate of this bug. ***
Working on a patch for this for 1.7. Any opinions on whether this would be appropriate to merge to 1.6.3 or not? Patch effects: - adds 'executable' attribute, default is still Ant's JDK's javadoc - cleans up code by dropping JDK 1.1 support completely (except for old="true") - since we dropped JDK 1.1 support for Ant 1.6, this was a no-op anyway - disables JDK version checks in case 'executable' is specified, i.e. old="true" will pass -1.1 unconditionally, and 1.4-specific parameters will be passed unconditionally if specified
Checking in WHATSNEW; /home/cvs/ant/WHATSNEW,v <-- WHATSNEW new revision: 1.797; previous revision: 1.796 done More commits to come... Checking in docs/manual/CoreTasks/javadoc.html; /home/cvs/ant/docs/manual/CoreTasks/javadoc.html,v <-- javadoc.html new revision: 1.33; previous revision: 1.32 done More commits to come... Checking in src/main/org/apache/tools/ant/taskdefs/Javadoc.java; /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v <-- Javadoc.java new revision: 1.140; previous revision: 1.139 done
+1 on merging - if possible before Antoine cuts the RC.
OK, will merge then. Strictly speaking it's an RFE, yet when you need it and don't have it, the alternative - using <apply> - is really hairy, as we found: http://www.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl?r1=1.26&r2=1.28 So the merge: Checking in WHATSNEW; /home/cvs/ant/WHATSNEW,v <-- WHATSNEW new revision: 1.503.2.211; previous revision: 1.503.2.210 done More commits to come... Checking in docs/manual/CoreTasks/javadoc.html; /home/cvs/ant/docs/manual/CoreTasks/javadoc.html,v <-- javadoc.html new revision: 1.26.2.7; previous revision: 1.26.2.6 done More commits to come... Checking in src/main/org/apache/tools/ant/taskdefs/Javadoc.java; /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v <-- Javadoc.java new revision: 1.124.2.8; previous revision: 1.124.2.7 done Misc. trunk cleanups: Checking in WHATSNEW; /home/cvs/ant/WHATSNEW,v <-- WHATSNEW new revision: 1.799; previous revision: 1.798 done More commits to come... Checking in docs/manual/CoreTasks/javadoc.html; /home/cvs/ant/docs/manual/CoreTasks/javadoc.html,v <-- javadoc.html new revision: 1.34; previous revision: 1.33 done More commits to come... Checking in src/main/org/apache/tools/ant/taskdefs/Javadoc.java; /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v <-- Javadoc.java new revision: 1.141; previous revision: 1.140 done