英文:
Scala-3.3.0: dotty.tools.FatalError: cannot resolve reference to
问题
我在scala-3.3.0和akka(或pekko)中遇到了这个错误:
dotty.tools.FatalError: 无法解析对类型 akka.stream.scaladsl.type.Source 的引用
dotty.tools.FatalError: 无法解析对类型 org.apache.pekko.stream.scaladsl.type.Source 的引用
在这两种情况下,我在任何源代码或依赖项中都找不到这样的引用。
为了演示这个问题,我创建了一个小的GitHub存储库:
https://github.com/abrighton/scala3-test
主分支使用pekko,而“akka-version”分支使用akka。
两者都使用java-17和scala-3.3.0。
我找到的可能相关的最接近的问题是:
https://github.com/lampepfl/dotty/pull/16373
有什么想法是什么可能导致这个问题的原因吗?
英文:
I'm seeing this error with scala-3.3.0 and akka (or pekko):
dotty.tools.FatalError: cannot resolve reference to type akka.stream.scaladsl.type.Source
dotty.tools.FatalError: cannot resolve reference to type org.apache.pekko.stream.scaladsl.type.Source
In both cases I see no such reference in any of the sources or dependencies.
To demonstrate the problem, I created a small GitHub repo:
https://github.com/abrighton/scala3-test
The main branch uses pekko and the "akka-version" branch uses akka.
Both use java-17 and scala-3.3.0.
The closest issue I could find that might be related was:
https://github.com/lampepfl/dotty/pull/16373
Any ideas what could be causing this?
答案1
得分: 1
你正在使用pekko-http作为依赖。
> Pekko HTTP模块在pekko-actor
和pekko-stream
之上实现了完整的服务器和客户端HTTP堆栈。
这意味着您还需要在类路径中添加依赖项pekko-actor和pekko-stream。
只需添加
libraryDependencies += "org.apache.pekko" %% "pekko-stream" % PekkoVersion
应该可以解决您的问题。
附带说明:
不确定文档是否不完整,或者pekko-http
的Hello World示例是否难以找到。查看Pekko模块,pekko-stream
未列出。我找不到g8模板
或类似的内容。
仅根据您分享的错误消息
dotty.tools.FatalError: 无法解析到类型 akka.stream.scaladsl.type.Source
dotty.tools.FatalError: 无法解析到类型 org.apache.pekko.stream.scaladsl.type.Source
并且知道Source
来自stream
模块,我采取了一个猜测,添加了pekko-stream
依赖项,编译成功。
编辑:
找到一个pekko http quickstart模板。
英文:
You are using pekko-http as a dependency
> The Pekko HTTP modules implement a full server- and client-side HTTP stack on top of pekko-actor
and pekko-stream
.
Which means you need to have also the dependencies pekko-actor and pekko-stream added in the classpath.
Just adding
libraryDependencies += "org.apache.pekko" %% "pekko-stream" % PekkoVersion
should fix your problem.
Side Note:
Not sure if the docs are incomplete or a hello world for pekko-http
is hard to find. Checking the Pekko Modules, pekko-stream
is not listed. I couldn't find g8 template
or something similar.
Just based on the error message you shared
dotty.tools.FatalError: cannot resolve reference to type akka.stream.scaladsl.type.Source
dotty.tools.FatalError: cannot resolve reference to type org.apache.pekko.stream.scaladsl.type.Source
And knowing that Source
comes from the stream
module, I took a wild guess and added the pekko-stream
dependency and the compilation succeed.
EDIT:
found a pekko http quickstart template
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论