sbt / sbt-eclipse

Plugin for sbt to create Eclipse project definitions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EclipseKeys.eclipseOutput isn't used for play generated routes

jkleckner opened this issue · comments

Using bin as the default output directory for eclipse generated class files can be problematic for projects that use that directory for scripts or other purposes. But if I override the eclipseOutput variable by adding the following line to build.sbt it isn't used as the target for Play Framework generated route files:

EclipseKeys.eclipseOutput in ThisBuild := Some(".target/bin")

To reproduce this in a Play Framework:

  • Add the line above to build.sbt.
  • Re-create the eclipse settings for example with: sbt 'eclipse with-source=true skip-parents=false'
  • Open your project in Eclipse and clean the project to force a build
  • Observe that there are files in both bin/ and .target/bin such as bin/Routes.class and .target/bin/routes
    The .classpath has entries to store some but not all objects in the dir (note in particular the last entry):
  <classpathentry output=".target/bin" kind="src" path="app-2.11"/>
  <classpathentry output=".target/bin" kind="src" path="app"/>
  <classpathentry output=".target/bin" kind="src" path="conf"/>
  <classpathentry output=".target/bin" kind="src" path="test/resources"/>
  <classpathentry output=".target/bin" kind="src" path="test-2.11"/>
  <classpathentry excluding="resources/" output=".target/bin" kind="src" path="test"/>
  <classpathentry kind="output" path="bin"/>

Glancing at the source, it appears that settings are using createSrc here and here but that the createSrc implementation does not use the setting. Should it use the eclipseOutput function to set this?
Empirically, if I manually edit the last entry from above to be the following, the source is all put in the proper place:

  <classpathentry kind="output" path=".target/bin"/>

It looks to my eye as though this line is where all the uses of "bin" could properly be set to the eclipseOutput setting.
Separately, not everyone on our team uses Eclipse, so it would be nice to be able to set this default in the global plugin settings without having to alter all the build.sbt files with tooling. Is there some way to do this?

Looks like fixing this bug requires a substantial investment in learning scalaz. Anyone familiar see how to apply the eclipseOutput setting to the kind=output directory path?