3

以前は機能していた次のようなコードがありました。

.settings(watchSources := watchSources.value.filterNot(_.getPath.contains("target")))

SBT 1.x では、次のようになります。

error: value getPath is not a member of sbt.Watched.WatchSource
x.getPath.contains("target")

の関数パラメーターに型を追加して、コードを少し拡張しますfilterNot

.settings(watchSources := (watchSources.value.filterNot{x: File =>
  x.getPath.contains("target")
}))

別のエラーが発生します。

[info] Loading project definition from /home/brandon/workspace/CCRS/project
/home/brandon/workspace/CCRS/build.sbt:111: error: type mismatch;
 found   : sbt.File => Boolean
    (which expands to)  java.io.File => Boolean
 required: sbt.Watched.WatchSource => Boolean
    (which expands to)  sbt.internal.io.Source => Boolean
  .settings(watchSources := watchSources.value.filterNot{x: File =>
                                                             ^

奇妙なことに、IntelliJ はコードがそのままで問題ないと考えているようです (最新バージョンの SBT で更新した後、IntelliJ を再起動しましbuild.propertiesx) 。FileWatchSourcewatchSources.valueSeq[File]

これに関連するがより一般的な質問 ( sbt 1.0.x での WatchSource の削除または除外) は、これまでのところ注目を集めていないようです。

4

0 に答える 0