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

`not found: type ...` when using `doc` without explicit import

Open JustinPihony opened this issue 6 years ago • 2 comments

When you specify a type through inheritance without an explicit import then you get a compiler error in the doc task.

This is reproducible in the Lagom Java Chirper Example. Update the project/plugins.sbt by adding the following to the defaultPlugins Seq:

sbtPluginExtra("com.eed3si9n" % "sbt-buildinfo" % "0.7.0", sbtV, scalaV)

Then update the build.sbt's chirplmpl to start like this:

lazy val chirpImpl = project("chirp-impl")
  .enablePlugins(LagomJava, BuildInfoPlugin)
  .settings(
    buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
    buildInfoPackage := "chirp",
    ...

Now when you run sbt doc you get the following:

[error] /lagom-java-chirper-example-master/chirp-impl/src/main/java/sample/chirper/chirp/impl/ChirpRepositoryImpl.java:119: not found: type ReadSideHandler [error] public ReadSideHandler<ChirpTimelineEvent> buildHandler() {

The current workaround is to go to ChirpRepositoryImpl.java and add

import com.lightbend.lagom.javadsl.persistence.ReadSideProcessor.ReadSideHandler;

This is needed because ReadSideHandler is only available due to the extension of ReadSideProcessor, but is not working once you add sbt-buildinfo

JustinPihony avatar Apr 09 '18 00:04 JustinPihony

this is so confusing/insane. how does generating build info of name, version, scalaVersion and sbtVersion affect generating docs for src/main/java/sample/chirper/chirp/impl/ChirpRepositoryImpl.java??

dwijnand avatar Apr 09 '18 10:04 dwijnand

My best guess is maybe https://github.com/sbt/sbt-buildinfo/blob/master/src/main/scala/sbtbuildinfo/ScalaCaseObjectRenderer.scala#L35 ?

JustinPihony avatar Apr 09 '18 18:04 JustinPihony