Search code examples
scalasbtscaladoc

Scaladoc: @group tag not showing in API documentation


I'm trying to organise the members of a class in my library API documentation using @groupname and @group tags, but it doesn't work (I'm using sbt 0.13.11)

My toy build.sbt:

name := "test"
scalaVersion := "2.10.5"

My toy code src/main/scala/test.scala:

package test
/** Test class
 *
 * @groupname print Printer
 * @groupname throw Thrower
 */
class TestClass {
  /** @group print */
  def trivialPrint: Unit = print("Hello")
  /** @group throw */
  def trivialError: Unit = throw new Exception("Hello")
}

sbt doc compiles an API doc where both my functions are in the "Value Members" group of the class (cf. screenshot). What am I doing wrong?

enter image description here


Solution

  • Prior to Scala 2.11 you have to explicitly ask for Scaladoc grouping support in your build.sbt:

    name := "test"
    scalaVersion := "2.10.5"
    scalacOptions += "-groups"
    

    You could scope it to in (Compile, doc), but I'm not sure it matters much.

    Like most things related to Scaladoc this is essentially undocumented, but it works.