How to resolve version conflicts in IntelliJ SBT included libraries

不问归期 提交于 2019-12-12 02:57:21

问题


I am using ScalaTest 2.2.1 in my project but some dependency I use brings in ScalaTest 1.9.2. In SBT, this causes no proble. It compiles and runs all tests.

In IntelliJ, the test show the in with "cannot resolve symbol in" although it still compiles. Hoever the test runner dies with"

An exception or error caused a run to abort: org.scalatest.FlatSpecLike$$anonfun$1$$anon$2 cannot be cast to org.scalatest.words.ResultOfStringPassedToVerb

If I manually remove ScalaTest 1.9.2 from the External Libraries, all works again, but of course the next time the project refreshes, I'm back to square one.

Is there some configuration for conflict resolution in IntelliJ that I need to set or is this an IntelliJ bug?


回答1:


SBT, internally, defaults its conflictManager to latestRevision. However, when intellij runs its own version of the SBT build, it doesn't seem to set the same default. What seems to work is to explicitly set the conflict manager in the SBT config:

conflictManager := ConflictManager.latestRevision

Intellij will still color code certain aspects of the test in my scenario as "Cannot resolve symbol", but neither compile, not test run are failing anymore



来源:https://stackoverflow.com/questions/25964522/how-to-resolve-version-conflicts-in-intellij-sbt-included-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!