ant中使用javadoc可能会遇到如下异常:
java.lang.IllegalArgumentException、
com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
解决方案:
1、去除系统环境变量中的classpath。
2、命令行运行ant前先挪去classpath “set classpath=”
doc:
[mkdir] Created dir: D:\workspace_center\workspace3.2.2\antExample\doc
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] 正在装入软件包 com 的源文件
[javadoc] 正在构造 Javadoc 信息
[javadoc] 标准 Doclet 版本 1.6.0_05
[javadoc] 正在构建所有软件包和类的树
[javadoc] 正在生成 D:\workspace_center\workspace3.2.2\antExample\doc\com/\HelloAnt.html
[javadoc] java.lang.IllegalArgumentException
[javadoc] at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
[javadoc] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:953)
[javadoc] at sun.misc.URLClassPath$3.run(URLClassPath.java:326)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
[javadoc] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
[javadoc] at sun.misc.URLClassPath.findResource(URLClassPath.java:144)
[javadoc] at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
[javadoc] at java.lang.ClassLoader.getResource(ClassLoader.java:977)
[javadoc] at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1159)
[javadoc] at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:96)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:89)
[javadoc] at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:250)
[javadoc] at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:223)
[javadoc] at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:128)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:72)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:108)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:155)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:164)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:597)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:215)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:91)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:31)
[javadoc] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:79)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:108)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:155)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:164)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:597)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:215)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:91)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:31)
[javadoc] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:159)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:164)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:597)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:215)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:91)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:31)
BUILD SUCCESSFUL
Total time: 2 seconds