How to get Eclipse to resolve BuildInfo in an sbt / Scala/ BuildInfo project

479 views Asked by At

Some Scala / SBT projects such as Tugboat or giter8 use BuildInfo - for example see here and here. When I import these projects into Eclipse after creating project files using sbteclipse the project will not compile as it cannot resolve BuildInfo.

There are some instructions about how to resolve this in the BuildInfo README. However If I add the suggested line to the Tugboat SBT file:

  EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Managed

it does not resolve the problem. In the Tugboat SBT file it specifies some other settings - do I need to do anything else to get access to BuildInfo in Eclipse?

1

There are 1 answers

0
Mark Butler On

The EclipseCreateSrc.Managed setting tells Eclipse to use managed sources i.e. automatically created code. In the case of tugboat, the BuildInfo managed source should be found in tugboat\target\scala-2.11\src_managed\main\sbt-buildinfo (the exact directory depends on your Scala version).

I resolved my problem by calling compile from the sbt command line prior to building in Eclipse. This should generate the BuildInfo.scala file. Once this is file is present the project should generate successfully. Eclipse does not seem to be able to generate this file itself.