maven配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<attach>true</attach>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<charset>UTF-8</charset>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
报错信息如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:jar (attach-javadocs) on project notify-core: 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:1338)
[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:570)
[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:565)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:564)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:529)
[ERROR] at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:494)
[ERROR] at sun.misc.URLClassPath.access$100(URLClassPath.java:66)
[ERROR] at sun.misc.URLClassPath$1.next(URLClassPath.java:276)
[ERROR] at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:287)
[ERROR] at java.net.URLClassLoader$3$1.run(URLClassLoader.java:604)
[ERROR] at java.net.URLClassLoader$3$1.run(URLClassLoader.java:602)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader$3.next(URLClassLoader.java:601)
[ERROR] at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:626)
[ERROR] at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
[ERROR] at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
[ERROR] at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:354)
[ERROR] at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
[ERROR] at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
[ERROR] at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
[ERROR] at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
[ERROR] at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:89)
[ERROR] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:120)
[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:189)
[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:194)
[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:139)
[ERROR] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:82)
[ERROR] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:80)
[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:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:310)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:189)
[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:366)
[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:219)
[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:205)
[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:64)
[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:54)
[ERROR] javadoc: 错误 - java.lang.IllegalArgumentException
[ERROR]
[ERROR] Command line was: C:\Users\XUEYE\scoop\apps\oraclejdk8\current\jre\..\bin\javadoc.exe @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in 'D:\Repositories\CICDI\notify-component\notify-core\target\apidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :notify-core
我建议的解决方式,先去系统环境变量中检查一下CLASSPATH是不是用%JAVA_HOME%
(例如:%JAVA_HOME%\lib\tools.jar
等)来配置的,如果是改成绝对路径(C:\Programs Files\Java\lib\tools.jar
)。
如果没有解决,自行Google。哈哈哈哈!因为我也是搜了很久,都没有找到解决方法,还是自己试出来的。网上大部分都是说版本问题、配置问题什么的。没想到是环境变量的问题吧。