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

2019-04-24 22:59发布

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.

2条回答
The star\"
2楼-- · 2019-04-24 23:29

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.

查看更多
Evening l夕情丶
3楼-- · 2019-04-24 23:33
<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.

查看更多
登录 后发表回答