Problem of sync sbt project
HI, I try to import a sbt project behind company firewall, I've updated the cacerts file and I can run below command to launch sbt shell in terminal session without issue:
/usr/lib/jvm/zulu11/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Dgrouping.with.qualified.names.enabled=true -Dseparate.prod.test.sources.enabled=true -Didea.managed=true -Dfile.encoding=UTF-8 -Didea.installation.dir=/jetbrains-cache/RemoteDev/dist/a478aeea39c30_ideaIU-2025.2.5 -jar /home/xxx/.local/share/JetBrains/IntelliJIdea2025.2/Scala/launcher/sbt-launch.jar
However, if I try to sync sbt project in IntelliJ IDE, I get those errors
[error] https://artifactory/io/circe/circe-parser_2.13/0.14.1/circe-parser_2.13-0.14.1-sources.jar: download error: Caught java.net.SocketException (Unexpected end of file from server) while downloading https://artifactory/io/circe/circe-parser_2.13/0.14.1/circe-parser_2.13-0.14.1-sources.jar
[error] https://artifactory/org/apache/logging/log4j/log4j-slf4j-impl/2.17.0/log4j-slf4j-impl-2.17.0-sources.jar: download error: Caught java.net.SocketException (Unexpected end of file from server) while downloading https://artifactory/org/apache/logging/log4j/log4j-slf4j-impl/2.17.0/log4j-slf4j-impl-2.17.0-sources.jar
[error] https://artifactory/io/circe/circe-numbers_2.13/0.14.1/circe-numbers_2.13-0.14.1-sources.jar: download error: Caught java.net.SocketException (Unexpected end of file from server) while downloading https://artifactory/io/circe/circe-numbers_2.13/0.14.1/circe-numbers_2.13-0.14.1-sources.jar
Will sbt plugin use JDK that come within some package and I need to update the cacerts somewhere else?
请先登录再写评论。
Ah, it seems like the error is only with downloading the library sources:
This is the default behaviour of SBT integration in IntelliJ IDEA Scala Plugin.
By default it tries to download the sources as it makes the experience during development nicer.
But the sources downloading is not granular and fail-safe - if downloading fails with any exception, the whole sbt task failes with an exception and the whole project sync fails.
(this could be addressed as part of https://youtrack.jetbrains.com/issue/SCL-23655/multi-phased-import-for-sbt-project / https://youtrack.jetbrains.com/issue/SCL-24918/SBT-Fetch-Sources-After-Sync )
Please, try disabling this setting as a workaround:
Settings | Build, Execution, Deployment | Build Tools | sbt | … | Download: *Thanks for the report!
Can you run this without issues in the IntelliJ Terminal as well?
(not only external terminal)
Is it only about standard project sync (by default it doesn't delegate to sbt shell).
If so, could you check if opening
sbt-shelltool window works?If yes, could you try delegate the build sync/reload to sbt shell and tell if that helps?
https://www.jetbrains.com/help/idea/sbt-support.html#sbt_shell
Also related:
https://github.com/sbt/sbt/issues/8679
Thanks, Dmitrii
Can you run this without issues in the IntelliJ Terminal as well? ← yes, it works
If so, could you check if opening
sbt-shelltool window works? ← it also workingPlease, try disabling this setting as a workaround:← great! it working. However, just wonder why download those failed? I can pull library when build….
Library sources are not needed to build the project.
They are only needed for a good Dev experience in IDE when inspecting library sources or invoking “Quick Documentation” action on library entities
Thanks a lot, understand that, but just wondering why the download Library sources is failing while download the Library jar is ok
The urls that I see in the output are invalid:
https://artifactory/org/apache/logging/log4j/log4j-slf4j-impl/2.17.0/log4j-slf4j-impl-2.17.0-sources.jar
I don't know why is that, but it can be related to some specifics of you project setup or machiene/network configuration.
It's hard to tell what exactly.
IntelliJ just tells SBT to download the sources, and it decides how to do that.
You can check it in terminal as well (to check if it's not related to IntelliJ):
Add
.withSources()to one of you libraries in the project and try to run `sbt`.If you see the same error, then I can't help you with your project setup, you should debug it/ask colleagues.
You could also try to do it in a fresh new sbt projects to check if it's something specific to sbt…
Maybe it's something with CDN/any other global settings on your machine/network.