Scrubbie
Scrubbie

Reputation: 1400

How to link third party libraries in Ant's javadoc task

I have a project that uses a third party library in the form of a jar file and I am using Ant to build the project javadocs. I can't get Ant to link to the third-party library javadocs when using the javadoc task.

Here is the javadoc task:

<javadoc excludepackagenames="" access="private" destdir="javadoc" author="true" 
         version="true" use="true" windowtitle="title" useexternalfile="true">
  <fileset dir="." defaultexcludes="yes">
    <include name="*/src/com/**/*.java"/>
  </fileset>

  <link href="http://www.redhillconsulting.com.au/products/simian/javadoc/"/> 
  <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>

The output from the task says that the simian package does not exist:

[javadoc] C:\development\java\tools\src\com\cname\DuplicateCodeIdentifier.java:15: package au.com.redhillconsulting.simian does not exist
[javadoc] import au.com.redhillconsulting.simian.Checker;
[javadoc]                                        ^

Running the ant task creates all the links to the Sun website correctly but not to the redhillconsulting site. Both URLs lead to a package-list file and appropriate paths (matching the package-list contents).

How do I configure the <javadoc> Ant task to generate the links to the third-party site?

Note: The simian jar file is in tools/lib. I haven't seen it specified that any sort of classpath is an option so I haven't explored that avenue but I have tried adding the jar file to the fileset include path and that wasn't any good.

Upvotes: 7

Views: 8074

Answers (2)

emax
emax

Reputation: 387

For *java-files, this didn't work for some reason. I managed do solve this with filesets, one of which including my current projects files, the other one including the additional package files. I simply didn't use the sourcepath attribute. It is easy to add more files at will. However, I didn't try for *jar files.

<target name="doc" depends="init" description="generate documentation">
  <javadoc 
       destdir="${doc.dir}"
       access="private"
       author="yes"
       linksource="yes">
    <fileset dir="./MyProject" includes="**/*.java" />        
    <fileset dir="./GuiPackage" includes="**/*.java" />        
  </javadoc>
</target>

Upvotes: 0

karoberts
karoberts

Reputation: 9938

The javadoc tag accepts an embedded classpath tag

<javadoc ...>
    <classpath>
        <fileset dir="${dir.lib}">
            <include name="simian.jar"/>
        </fileset>
    </classpath>
</javadoc>

Upvotes: 14

Related Questions