sbteclipse not adding generated source folders to java build path?

786 views Asked by At

I ran sbt eclipse on a Scala Project and when I imported it into Scala IDE(4.0.0 RC2), it gave me a type not found error as the types referred to were actually auto-generated code which were at target/scala-2_10/src_managed/main/compiled_avro/org/... I was able to do a sbt compile at the console though.

I got it to compile by adding the above folder to the Java Build Path.

My question is that since sbt eclipse can already detect Java Projects which the current project depends on and since sbt compile works at the console, should sbt eclipse be able to figure out dependencies to source folders of generated code as well? or maybe such a feature exists and I just don't know about it?

2

There are 2 answers

0
ben jarman On BEST ANSWER

This may not be the correct way of doing things but to fix the issue i did the following.

  1. sbt avro:compile
  2. sbt compile
  3. sbt eclipse
  4. In eclipse i right clicked on target/scala-*/src_managed/main/compiled_avro > build path > use as source folder
1
Richard Sitze On

The sbteclipse way:

  1. Edit your project or global build.sbt file. My global ~/.sbt/0.13/build.sbt contains:

    import com.typesafe.sbteclipse.plugin.EclipsePlugin._
    
    EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Managed
    

    I'm using an older version of _sbteclipse, version 2.5.0 (various non-relevant reasons), which seems to require both the import and a single blank link between each line of real content (this drives me a bit crazy, yes). I don't believe the import is required for newer versions of sbteclipse.

  2. sbt clean avro:compile compile

  3. sbt eclipse