LoginSignup
8
9

More than 5 years have passed since last update.

Eclipseで Scalaの build path is cross-compiled with an incompatible version of Scala エラーを回避する方法

Posted at

Scalaを 2.11にあげている場合に、2.10で作られた jarをリンクしようとすると、コマンドラインではビルドできるのに、Eclipseでビルドしようとすると、以下のようなエラーを吐いてビルドできないことがあります。

build path is cross-compiled with an incompatible version of Scala (2.10.0.). In case this report is mistaken, this check can be disabled in the compiler preference page.

ここに指示がある通り、Scalaの compiler 設定を開くと、

スクリーンショット 2014-11-13 18.12.55.png

のように withVersionClasspathValidator というチェックボックスがONになっています。これを外せばいいはずなのですが、チェックを外して設定画面を閉じても、もう一度設定画面を開くとチェックが元に戻ってしまいます!

回避方法

いろいろ試しましたが、設定ファイルを直接いじるしか方法がないようです。

Eclipseの workspaceの設定を変更する

workspace全体の設定を変えたい場合は、ワークスペースの <workspace-dir>/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.scala-ide.sdt.core.prefs ファイルを編集し、以下のように withVersionClasspathValidator=false を追加します。

eclipse.preferences.version=1
org.scala-ide.sdt.core.diagnostic.currentPluginVersion=4.0.0.m3-2_11-201407240952-b0e64c7
withVersionClasspathValidator=false

この設定を変更したら Eclipseを再起動するとめでたくチェックが外れます。

プロジェクト設定を変更する

プロジェクトの設定にも同じ設定があります。こちらをいじりたい場合は、プロジェクトの <project-dir>/.settings/org.scala-ide.sdt.core.prefs を編集し、やはり、 withVersionClasspathValidator=false を追加します。

これで Eclipseを再起動するか、F5キーなどでプロジェクトをリロードすれば反映されます。

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9