<#20356 Scalac fails when using plugins that emit ...
# github-notifications
c
#20356 Scalac fails when using plugins that emit additional compilation results Issue created by alonsodomin Describe the bug Some Scala compiler plugins emit additional compilation results from the typical output that comes out of
scalac
. Some of those plugins are
semanticdb
,
scalajs
,
scalanative
and others. The scenario workspace is as follows: `3rdparty/jvm/BUILD`:
Copy code
jvm_artifact(
  name="scala-library",
  group="org.scala-lang",
  artifact="scala-library",
  version="2.13.12",
)

scala_artifact(
  name="semanticdb-jar",
  group="org.scalameta",
  artifact="semanticdb-scalac",
  version="4.8.15",
  crossversion="full"
)

scalac_plugin(
  name="semanticdb",
  artifact=":semanticdb-jar"
)
`pants.toml`:
Copy code
[GLOBAL]
pants_version = "2.18.1"
backend_packages = [
  "pants.backend.experimental.scala",
]

[source]
root_patterns = [
  '/src/scala',
]

[jvm]
jdk = "temurin:1.11"
tool_jdk = "temurin:1.11"

[scala.version_for_resolve]
jvm-default = "2.13.12"

[scalac]
args = ["-Yrangepos"]

[scalac.plugins_for_resolve]
jvm-default = "semanticdb"
`src/scala/example/BUILD`:
Copy code
scala_sources()
`src/scala/example/SimpleApp.scala`:
Copy code
package example

object SimpleApp {
  def main(args: Array[String]) {
    println("Hello World")
  }
}
When running
pants check ::
the following error is shown:
Copy code
2:34:01.06 [ERROR] Completed: pants.backend.scala.compile.scalac.compile_scala_source - src/scala/example/SimpleApp.scala failed (exit code 1).
error: src.scala.example.SimpleApp.scala.scalac.jar (Is a directory)
1 error

12:34:01.06 [ERROR] Completed: Check compilation for Scala - scalac - scalac failed (exit code 1).
Pants version 2.18.1 OS Both Additional info The error comes from the process running
scalac
as Pants expect it to output a JAR file but the additional output from the
scalac
plugin changes its behavior as it now produces a directory. pantsbuild/pants