Using Eclipse compiler instead of javac results in javadoc crash

只谈情不闲聊 提交于 2019-12-05 00:41:07

I finally got some time to look into this again. The maven-javadoc-plugin helpfully leaves behind a javadoc.bat script under target/site/apidocs when the javadoc.exe process fails, and I was able to find the offending package by pruning the list in the packages file that gets passed into javadoc.exe.

Interestingly, the problematic code turned out to be the Java source generated by the Google Protocol Buffers compiler. This was fortunate, since it's acceptable to simply exclude the protobuf-generated source from the Javadoc entirely.

I added the following definition, under both my <build> and <reporting> sections of the POM, and this resolved my issue:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.6.1</version>
    <configuration>
        <excludePackageNames>com.mycompany.myproject.proto</excludePackageNames>
    </configuration>
</plugin>

Workaround for this would be to create a separate profile for the site goal. So that you could define different compilers for different goals.

Maybe the javadoc.exe is not using the same JRE that Eclipse uses. Are their any other JRE's installed? Try running the javadoc.exe process manually and see if it does the same thing, you might get the actual stacktrace of the problem.

This might not be an answer, but just propose an idea.

How about installing the JDK in the folder without space (I saw it is C:\Program Files (x86)...). Java supports spaces in the file names, but probably some of the plugins/tools/library that javadoc tools just doesn't support it.

Im guessing that the problem is that javac and eclipse are using different JDK versions for compiling your code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!