Linus
Linus

Reputation: 1123

Cannot compile javadoc with Ant

I'm working on a Java project, and would like to not only compile the entire application but also the javadoc documentation using Apache Ant.

Currently, my compile target in my build.xml script looks like this:

<target name="compile">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${classes.dir}"/>
    <mkdir dir="${jar.dir}"/>
    <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" />
    <javadoc 
      sourcefiles="${src.dir}" 
      destdir="${doc.dir}/forecast"
      classpath="classpath"
      author="true"
      version="true"
      use="true"
      windowtitle="${App-name}"
      doctitle="&lt;h1&gt;${App-name}&lt;/h1&gt;" />
  </target>

My source files are to be found in the src/com//forecast directory, and all have the header

package com.<company_name>.forecast

However, when I run ant compile I get the following output:

[javadoc] Generating Javadoc
  [javadoc] Javadoc execution
  [javadoc] 1 error
  [javadoc] javadoc: error - Illegal package name: "/home/linus/fo/forecast/src/com/<company_name>/forecast"

and no javadoc is created. I think I've tried almost all combinations of possible Javadoc properties, but to no avail. What am I missing?! Thanks in advance, Regards,

Linus

Upvotes: 0

Views: 593

Answers (2)

BST
BST

Reputation: 531

Looks like the package names are not getting identified properly. Could you try specifying the packagenames parameter.

More information is available here

Example:

<javadoc packagenames="com.dummy.test.*"
       sourcepath="src"
       excludepackagenames="com.dummy.test.doc-files.*"
       defaultexcludes="yes"
       destdir="docs/api"
       author="true"
       version="true"
       use="true"
       windowtitle="Test API">  </javadoc>

Upvotes: 0

user3378195
user3378195

Reputation:

try using below command.

javadoc -sourcepath ./src *.java -d ./docs

Upvotes: 1

Related Questions