javadoc 抛 java.lang.IllegalArgumentException

【声明】本文为AdamsLee原创,转载请注明出自围炉网并保留本文有效链接:javadoc 抛 java.lang.IllegalArgumentException, 转载请保留本声明!

最近在机器上执行mvn javadoc:javadoc时,突然出现如下 IllegalArgumentException 的错误,但wrdoclet中运行Test.main() 来生成文档时没有抛错,非常诡异。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project wrdoclet: MavenReportException: Error while generating Javadoc:

[ERROR] Exit code: 1 – java.lang.IllegalArgumentException

[ERROR] at sun.net.www.ParseUtil.decode(ParseUtil.java:202)

[ERROR] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:1039)

[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:361)

[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:356)

[ERROR] at java.security.AccessController.doPrivileged(Native Method)

[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)

[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)

[ERROR] at sun.misc.URLClassPath.findResource(URLClassPath.java:175)

[ERROR] at java.net.URLClassLoader$2.run(URLClassLoader.java:551)

[ERROR] at java.net.URLClassLoader$2.run(URLClassLoader.java:549)

[ERROR] at java.security.AccessController.doPrivileged(Native Method)

[ERROR] at java.net.URLClassLoader.findResource(URLClassLoader.java:548)

[ERROR] at java.lang.ClassLoader.getResource(ClassLoader.java:1147)

[ERROR] at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227)

[ERROR] at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:94)

[ERROR] at java.security.AccessController.doPrivileged(Native Method)

[ERROR] at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:87)

[ERROR] at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:283)

[ERROR] at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:255)

[ERROR] at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:126)

[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:88)

[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:117)

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:186)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)

[ERROR] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

[ERROR] at java.lang.reflect.Method.invoke(Method.java:606)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)

[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)

[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:167)

[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:59)

[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:49)

[ERROR] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException

[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:95)

[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:117)

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:186)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)

[ERROR] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

[ERROR] at java.lang.reflect.Method.invoke(Method.java:606)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)

[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)

[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:167)

[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:59)

[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:49)

[ERROR] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:190)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)

[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)

[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)

[ERROR] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

[ERROR] at java.lang.reflect.Method.invoke(Method.java:606)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)

[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)

[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)

[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:167)

[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:59)

[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:49)

[ERROR]

[ERROR] Command line was: D:ToolsJavajdk1.7.0_79jre..binjavadoc.exe @options @packages

  1. ParseUtil源代码,没有发现问题。
  2. 因为机器上既有jdk1.7的项目也有jdk1.8的项目,所以机器上同时按照了两个版本的jdk。担心哪里jdk弄坏了,因此重装了jdk,但还是没有用。
  3. github上下载别人的代码执行mvn javadoc:javadoc 也会抛错,说明是环境问题
  4. 最后想到自己配置JAVA_HOME做了一个特殊处理

这样在切换不同版本的jdk会比较方便,会不会是因为这个问题导致的呢?尝试把JAVA_HOME改成常规的路径配置后执行mvn javadoc:javadoc 果然回复了。

此条目发表在Uncategorized分类目录,贴了标签。将固定链接加入收藏夹。