Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get javadoc to link to the Java API using an Ant task?

Tags:

javadoc

ant

Right now my ant task looks like.

<javadoc sourcepath="${source}" destdir="${doc}">
    <link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
</javadoc>

And I'm getting this warning:

javadoc: warning - Error fetching URL: http://java.sun.com/j2se/1.5.0/docs/api/package-list

How do I get the javadoc to properly link to the API? I am behind a proxy.

like image 495
Rob Spieldenner Avatar asked Dec 03 '22 09:12

Rob Spieldenner


2 Answers

You can also pass the arguments inside the ant task

<arg value="-J-Dhttp.proxyHost=your.proxy.here"/>
<arg value="-J-Dhttp.proxyPort=##"/>

If going the offline link route. Download the package list by going to the URL of the Java API (http://java.sun.com/j2se/1.5.0/docs/api/package-list) and saving it as a text file and then using this Ant task.

<javadoc sourcepath="${source}" destdir="${doc}">
    <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistloc="path-containing-package-list"/>
</javadoc>
like image 157
Rob Spieldenner Avatar answered Dec 20 '22 23:12

Rob Spieldenner


You probably need the http.proxyHost and http.proxyPort system properties set. For example, ANT_OPTS="-Dhttp.proxyHost=proxy.y.com" ant doc

Alternatively, you could set the "offline" flag and provide a package list, but that could be a pain for the Java core.

like image 42
erickson Avatar answered Dec 20 '22 23:12

erickson