Eclipse中除2.12外的Scala编译器无法正常工作
Hey there, let's work through this frustrating Scala compiler issue you're facing. It sounds like the IDE isn't properly syncing with the Scala 2.10 compiler bundle, leading to build failures and missing error reporting. Here are targeted fixes to try:
1. Verify Scala-IDE and Target Version Compatibility
Your Scala-IDE version (4.7.0.v-2_12) is built primarily for Scala 2.12, so dynamic bundles for older versions like 2.10 might need extra setup. First:
- Go to
Help > Install New Software - Select the Scala IDE update site you used originally
- Check if there are any missing components for Scala 2.10 (look for packages labeled "Scala 2.10 Compiler Bundle" or similar)
- Install any missing components and restart Eclipse
2. Force a Full Clean & Rebuild
Eclipse's build cache often gets stuck when switching versions. Try this thorough reset:
- Right-click your project >
Clean - After cleaning, go to
Project > Build All(not just "Build"—this ensures all projects are rebuilt from scratch) - If that still doesn't work, manually delete the
targetfolder in your project, plus the.settings/org.scala-ide.sdt.core.prefsfile, then reimport the project into Eclipse
3. Check Project Configuration Files
Sometimes the .classpath and .project files don't update correctly when switching Scala versions:
- Open the
.classpathfile in Eclipse (right-click >Open With > Text Editor) - Ensure all Scala-related entries point to Scala 2.10 libraries (not 2.12)
- If entries are wrong, right-click the project >
Scala > Add Scala Natureto regenerate these files correctly
4. Configure Installed Scala Compilers
Make sure Eclipse recognizes the Scala 2.10 compiler:
- Go to
Window > Preferences > Scala > Installed Scala Compilers - If Scala 2.10 isn't listed, click
Add > Standard Scala Compiler - Download the Scala 2.10.x binary archive, extract it locally, and point the IDE to that directory
- Set this as the default compiler for your project in
Properties > Scala Compiler
5. Fix Problems View Filtering
It's possible Scala errors are being hidden:
- Open the
Problemsview, click the dropdown arrow in the top-right corner - Select
Configure Filters - Ensure
Scala Problemsis checked, and no filters are excluding relevant errors
6. Update Run Configurations
Class-not-found errors usually stem from outdated run configurations:
- Go to
Run > Run Configurations - Select your Scala application configuration
- Switch to the
Classpathtab - Remove any Scala 2.12 libraries and add the Scala 2.10 library instead
- Save the configuration and try running again
These steps should resolve the compiler sync issues. Start with the clean/rebuild first—it fixes most cache-related problems. If you're still stuck, double-check that the Scala 2.10 bundle was fully installed without errors during setup.
内容的提问来源于stack exchange,提问作者eirasf

