Ant/Maven: “javadoc: warning - Error fetching URL”

不羁的心 提交于 2019-12-22 04:44:11

问题


I recently set up my build server (Jenkins) to generate Javadocs for Ant builds. However, no matter what I do, I can't get it to include links to external libraries. When I attempt to use an online link, Ant returns:

[javadoc] javadoc: warning - Error fetching URL: http://docs.oracle.com/javase/6/docs/api/package-list

When I use an offline link and reference a local copy of a package list, it gives no warnings, but doesn't generate links either. This occurs for every library I attempt to link, not just Java SE. Here are the respective lines for links in my build.xml:

<link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="javadoc/javase6/package-list" />

and:

<link href="http://docs.oracle.com/javase/6/docs/api/" />

It's worth mentioning that the internet connection of the server doesn't have a particularly unusual configuration. After a bit of research, I found that the warning I received is common when using a proxy, but I couldn't find any cases where it was returned on a server with a direct connection.

I'd also like to mention that I've verified that my offline package list is in the proper location and accessible via a relative path from the build file.

Edit #1: This is apparently an issue on Maven as well, suggesting that the Javadoc tool itself is broken.

Edit #2: It's worth mentioning that I'm using JDK 1.6 update 45 to compile.


回答1:


<link offline="true" href="http://docs.oracle.com/javase/6/docs/api/"
    packagelistLoc="javadoc/javase6/package-list" />

should be:

<link offline="true" href="http://docs.oracle.com/javase/6/docs/api/"
    packagelistLoc="javadoc/javase6/" />

packagelistLoc is a path to directory containing package-list file.




回答2:


It works fine, but for clarity, you need to download the package-list file from the Oracle website first, e.g. http://docs.oracle.com/javase/6/docs/api/package-list, and save that file to the folder you specified.



来源:https://stackoverflow.com/questions/22273529/ant-maven-javadoc-warning-error-fetching-url

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