scalascaladoc

How to include comments for a package with scaladoc?


So, for scaladoc, you can specify comments for a particular component of your code like so:

package connector

import java.io.RandomAccessFile;

/** Fs class guides file opening
  *
  */
object fs {
    def printFile(path:String):Unit = {
        val fl = new RandomAccessFile(path, "rw");
        println(fl.readLine());
        println(fl.getFilePointer());
        fl.close();
    }
}

However, I don't see where or how you would include a comment that will appear in the index.html generated by scaladoc for the package starting page. How is this done?


Solution

  • Create a package object (package.scala) and add you documentation there:

    /**
     * Fs class guides file opening
     */
    package object connector {}