Simultaneous incremental compilation in SBT and Scala -IDE

When I try to work with the same project both from the SBT command line and from Scala -IDE, creating several times in the same way (that is, only from the command line or only from the IDE) allows the project to be rebuilt gradually. However, if I compile the project in SBT, I noticed that it must be fully restored in the IDE (and vice versa). Is there any way to avoid this? If that matters, the Eclipse project is generated from SBT using sbteclipse.

+4
source share
1 answer

For me, the problem of running ScalaIDE and sbt ~ compile at the same time turned out to be the fact that both ScalaIDE and sbt used the same output directory to compile them. This meant that they overwrite each other with compiled classes and defined them as modified, which led to a new full recompilation instead of using incremental compilation.

To fix this, change the output directory of one of the compilers by doing one of the following:

  • manually: Project properties → Java build path → find the scala source folder for both the main and tests (usually [project] / src / [test / main] / scala) and edit their output to be something other than the default (for example, [project] / target / eclipse)
  • add to the build.sbtfollowing directive:

     EclipseKeys.eclipseOutput := Some("target/eclipse")
    

ScalaIDE [project]/target/eclipse, project .

, , last compile sbt, ( sbt). , , . , sbt- ScalaIDE , .

+3

Source: https://habr.com/ru/post/1533522/


All Articles