-
Notifications
You must be signed in to change notification settings - Fork 21
Description
After running a full build of a Scala project in Eclipse, the output folder does not contain class files for Scala source files. Furthermore, the plugin doesn't realize that the class files aren't there, and therefore subsequent incremental builds also fail to compile the class files. Note that class files are created correctly by an initial incremental build. Only full builds have this problem. I have diagnosed and fixed this problem, and a patch is attached to this bug.
To Reproduce:[[BR]]
- Disable automatic incremental builds: Uncheck the menu "Project | Build Automatically"[[BR]]
- Create a scala project and add a source file.[[BR]]
- Configure the Java builder to scrub output folders on builds (by default this option is enabled). Find this option on the preference page: "Window | Preferences… |Java | Compiler | Building | Output folder | Scrub output folders when cleaning projects"[[BR]]
- Clean the project: select the project in the package explorer and click the menu "Project | Clean…" Check "Clean project(s) selected below", select the new project, and click Ok.[[BR]]
- Build the project: select the menu "Project | Build Project". (Note that this may be unnecessary if you checked the box "Start a build immediately" on the Clean dialog in the previous step.)[[BR]]
- Check the output folder for the project. It contains no class files for Scala sources.[[BR]]
Diagnosis[[BR]]
The class files aren't there because the Java builder immediately deletes class files that were just created by the Scala compiler. The Eclipse Scala builder executes a build in two steps. First it invokes the Scala builder to compile Scala sources, and then it invokes a Java builder to compile Java sources. If the Java builder is configured to scrub output folders for full builds, it deletes the class files created by the Scala compiler. The solution is for the Scala builder to temporarily disable the "Scrub output folders" option when it invokes the Java builder. Please see the attached patch, "scala-plugin-buildall-patch.txt", which implements this solution.