简体   繁体   中英

IntelliJ SBT project cannot resolve SBT symbols

I'm banging my head against the wall on this one.

Trying to open a cloned git SBT project at work. It is a combined Java and Scala Play project, with scala 2.11.1, SBT 0.13.6, and Play 2.5.

I use IntelliJ to import project from the cloned repo, with JDK 1.8, and all download and SBT checkboxes checked, and then run either SBT refresh, or reload from SBT shell.

After doing so, all SBT and Play code on both build.sbt and plugins.sbt is painted red, as in "cannot resolve symbol".

Looking at Intellij poroject structure, I have JDK1.8 on the SDK tab, and scala-sdk-2.11 on the Global Libraries tab. SBT and Scala plugins are installed and enabled.

SBT refresh fails on the following Play dependency, which could be the reason for the above symptom, since the SBT build does not complete:

unresolved dependency: com.typesafe.play.plugins#play-statsd_2.11;2.3.0: not found

The dependency does exist: http://dl.bintray.com/typesafe/maven-releases/com/typesafe/play/plugins/play-statsd_2.11/2.3.0/

What am I doing wrong?

在此处输入图片说明

Turns out the problem is on the typesafe side, not on my env. All typesafe dependencies on the project are resolved as expected, except for play-statsd.

I manually added this dependency to my ivy cache, and now everything works fine. It was a hard one to isolate, because apparently everybody here already have the dependency on their caches, so seems like their updates work well...

If anyone has the same problem, fetch the dependency from the bintray repository , and manually add it to your ivy cache, eg

~/.ivy2/cache/com.typesafe.play.plugins/play-statsd_2.11

The github play-plugins repository has been archived, so I can't open an issue, and don'y know if anyone will take care of it anyway.

Unresolved dependency error usually related with Scala version that you are using.

Here is Play 2.3.x documentation. https://www.playframework.com/documentation/2.3.x/Migration22#Update-Scala-version

If you are able to use Play 2.7.x, your issue will be fixed.

您能否按如下所示在build.sbt中添加Play StatsD依赖项并检查一次。

"com.typesafe.play.plugins" %% "play-statsd" % "2.3.0"

您应该添加Maven-releases解析器:

resolvers += "Typesafe Resolver" at "http://repo.typesafe.com/typesafe/maven-releases/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM