sbt-unidoc icon indicating copy to clipboard operation
sbt-unidoc copied to clipboard

<object> is already defined as trait ...

Open abrighton opened this issue 10 years ago • 4 comments

Unidoc is giving me errors when a trait or class has a companion object.

For example: RunId is already defined as object RunId RunId is already defined as case class RunId

The project containing the class is a scala/scala.js shared "crossProject" in a multi-project build (scala-2.11.7) . When I remove the shared project, the unidoc problems go away. This seems to also be a problem with the sbt gh-pages plugin.

abrighton avatar Oct 26 '15 22:10 abrighton

I have the same problem. Is there any known workaround?

julienrf avatar Jan 21 '17 22:01 julienrf

Explicitly disabling the javascript modules should solve that:

unidocProjectFilter in ( ScalaUnidoc, unidoc ) :=
    inAnyProject -- inProjects( i18nJS, schemaJS )

taig avatar Feb 07 '17 10:02 taig

@Taig Thanks. Explicitly removing JS projects worked for me. But I guess sbt-unidoc is including projects not mentioned in aggregate when building scaladoc.

xerial avatar Feb 16 '18 18:02 xerial

I encountered the same issue whilst using the sbt-scala-crossproject plugin. @Taig's approach works here as well. In this case, by disabling all but one of the versions.

lazy val root = project.in(file("."))
  .settings(
    autoAPIMappings := true,
    unidocProjectFilter in ( ScalaUnidoc, unidoc ) :=
      inAnyProject -- inProjects( models_2_11 )
  )
  .enablePlugins(ScalaUnidocPlugin)
  .aggregate(models_2_12)

scottweaver avatar Jul 26 '18 17:07 scottweaver