Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FetchError$DownloadingArtifacts when importing sbt project to IntelliJ with "sbt sources" checked #5501

Closed
louiselmps opened this issue Apr 8, 2020 · 32 comments
Labels
area/ide IntelliJ or Metals integration area/library_management library management Blocked on Upstream Bug needs info Needs more information to take further actions.

Comments

@louiselmps
Copy link

steps

sbt version: 1.3.6
scala version: 2.13.1
java version : "1.8.0_241"

  1. Downloaded scala and sbt
  2. created new project through: sbt new playframework/play-scala-seed.g8
  3. Once project has been created, i imported project folder to IntelliJ (i selected the sbt tool)
  4. imported sbt
  5. Error while importing sbt project

problem


List(;reload; set _root_.org.jetbrains.sbt.StructureKeys.sbtStructureOptions in Global := "download resolveClassifiers resolveSbtClassifiers" ;*/*:dumpStructureTo C:/Users/lanex-user/AppData/Local/Temp/sbt-structure.xml; session clear-all ; set ideaPort in Global := 52524
[info] Loading global plugins from C:\Users\lanex-user\.sbt\1.0\plugins
[info] Loading settings for project productlistapp-build from plugins.sbt,idea.sbt ...
[info] Loading project definition from C:\Users\lanex-user\Desktop\productlistapp\project
[info] Loading settings for project root from build.sbt ...
[warn] Discarding 1 session setting.  Use 'session save' to persist session settings.
[info] Set current project to productListApp (in build file:/C:/Users/lanex-user/Desktop/productlistapp/)
[info] Defining Global / sbtStructureOptions
[info] The new value will be used by Global / ssOptions
[info] Reapplying settings...
[info] Set current project to productListApp (in build file:/C:/Users/lanex-user/Desktop/productlistapp/)
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[error] stack trace is suppressed; run 'last updateSbtClassifiers' for the full output
[error] (updateSbtClassifiers) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/org/webjars/npm/4.2.0/npm-4.2.0-sources.jar: not found: https://repo1.maven.org/maven2/org/webjars/npm/4.2.0/npm-4.2.0-sources.jar
[error] Total time: 8 s, completed 8 Apr 2020, 6:18:07 PM)

Below is my build.sbt file

organization := "pakt.com"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.13.1"

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

// Adds additional packages into Twirl
//TwirlKeys.templateImports += "pakt.com.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "pakt.com.binders._"

expectation

SBT project should have synced successfully

notes

Already tried the latest version (1.3.9)

@louiselmps louiselmps added the Bug label Apr 8, 2020
@MickaToast
Copy link

Same issue

@eed3si9n
Copy link
Member

@louiselumapas Thanks for the report. I wonder if this is a duplicate of #5219 / #4707 / coursier/coursier#1541

Would not checking the checkbox to download sbt sources work around this issue?
Another potential workaround might be to write:

useCoursier := false

in project/plugins.sbt.

@eed3si9n
Copy link
Member

Using IntelliJ IDEA 2019.3.4 (Community Edition) I was able to import fine.

[info] Loading settings for project global-plugins from idea.sbt,vimquit.sbt,plugins.sbt,pgp.sbt ...
[info] Loading global plugins from /Users/eed3si9n/.sbt/1.0/plugins
[info] Loading settings for project hello-play-build from plugins.sbt ...
[info] Loading project definition from /private/tmp/hello-play/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to hello-play (in build file:/private/tmp/hello-play/)
[info] sbt server started at local:///Users/eed3si9n/.sbt/1.0/server/e5edd2c569689866984d/sock
[hello-play] $
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info] 	Run `last` for details.
[info] Reapplying settings...
[info] Set current project to hello-play (in build file:/private/tmp/hello-play/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/eed3si9n/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.6911.18/IntelliJ IDEA CE.app.plugins/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] Set current project to hello-play (in build file:/private/tmp/hello-play/)
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Writing structure to /private/var/folders/hg/2602nfrs2958vnshglyl3srw0000gn/T/sbt-structure.xml...
[info] Done.
[success] Total time: 59 s, completed Apr 11, 2020 10:10:17 PM
[info] shutting down sbt server

@eed3si9n eed3si9n added the needs info Needs more information to take further actions. label Apr 12, 2020
@eed3si9n
Copy link
Member

Here's my PR towards fixing this - coursier/sbt-coursier#212

@louiselmps
Copy link
Author

Thanks! it seems to be working perfectly fine now after I tried re-importing again without editing the plugins.sbt. Weird

@catflyflyfly
Copy link

catflyflyfly commented Apr 20, 2020

I think I solved the issue. In IntelliJ IDEA, go to Preferences => Build, Execution, Deployment => Build Tools => sbt => sbt projects. Unticked "Library sources" & "sbt sources".

I tested it on 2019.3.4 & 2020.1. Both versions work correctly.

This pretty nasty issue take me whole 2 days to debugging. :( sad

See Also: https://stackoverflow.com/a/48473825

Edit: On 2020.1, there is currently an another issue https://youtrack.jetbrains.com/issue/SCL-17212. For now, I decided to downgrade back to 2019.3.4.

@louiselmps
Copy link
Author

@catflyflyfly It took me a whole day to solve this problem! I did not come across that stackoverflow solution. That would have been a great help. Also, make sure to have the "overriding sbt version" unticked. Currently using the 2019 version no plans on updating.

@eed3si9n eed3si9n changed the title 1.3.6 Error syncing sbt project in intellij FetchError$DownloadingArtifacts when importing sbt project to IntelliJ with "sbt sources" checked Apr 30, 2020
@eed3si9n eed3si9n added the area/ide IntelliJ or Metals integration label Apr 30, 2020
@He-Pin
Copy link

He-Pin commented May 4, 2020

With sbt 1.3.10

image
Reproduce:

  1. checkout akka/akka
  2. config idea as up screenshot.
  3. reimports the porjects
    image
    will gives you
    image

@almothafar
Copy link

I got the same issue, using .1.3.10 (actually the issue started since 1.3.7), and useCoursier := false didn't help.

This is an issue from a long time ago and becomes annoying, the workaround for it do downgrade to 1.3.6 then do import project, then back to 1.3.10,

But I have to deal with 'null' folder for Coursier cache which is resolved in 1.3.7.
image

I really hope versions of 1.3.x become stable at some point, they are doing it with not much care! and fixes are really slow.

eed3si9n added a commit to eed3si9n/sbt-coursier that referenced this issue May 6, 2020
This is a continuation of coursier#212 and coursier#223
Ref coursier/coursier#1541
Ref sbt/sbt#4707
Ref sbt/sbt#5374
Ref sbt/sbt#5501

coursier#212 fixed the resolve, but did not handle missing sources during fetch. This attempts to fix that.
@btmcnellis
Copy link

Confirmed that this is still an issue on sbt 1.3.13. I haven't tried useCoursier := false (I'm never going back to Ivy if I can avoid it), but updateConfiguration := updateConfiguration.value.withMissingOk(true) does not help. I can reproduce it without IntelliJ as well by just adding withSources() to a dependency that doesn't have a source jar.

@andreaTP
Copy link
Contributor

andreaTP commented Jul 8, 2020

Can confirm that this is still an issue (a possible regression after #5374 got fixed?).
The following is a minimal repro you can run in an empty directory:

mkdir -p project
echo "sbt.version=1.3.13" > ./project/build.properties
echo 'addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.2")' > ./project/plugins.sbt
sbt -ivy ./target/ivy -sbt-dir ./target/sbt updateSbtClassifiers

A temporary nasty workaround I found is to downgrade sbt version and bump it again:

echo "sbt.version=1.3.6" > ./project/build.properties
sbt -ivy ./target/ivy -sbt-dir ./target/sbt updateSbtClassifiers
echo "sbt.version=1.3.13" > ./project/build.properties
sbt -ivy ./target/ivy -sbt-dir ./target/sbt updateSbtClassifiers

I guess cc. @alexarchambault

@alexarchambault
Copy link
Contributor

@andreaTP This was fixed in sbt-coursier 2.0.0-RC6-5, that sbt doesn't depend on for now.

@alexarchambault
Copy link
Contributor

Locally, the following works fine for me:

$ mkdir -p project
$ echo "sbt.version=1.3.13" > ./project/build.properties
$ echo 'addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.2")' > ./project/plugins.sbt
$ curl -Lo sbt-cs https://github.com/coursier/sbt-extras/raw/master/sbt
$ COURSIER_CACHE="$(pwd)/target/cs-cache" ./sbt-cs -C--plugin-version=2.0.0-RC6-6 -ivy ./target/ivy -sbt-dir ./target/sbt updateSbtClassifiers

@ngbinh
Copy link

ngbinh commented Jul 16, 2020

This is a major problem for me working on a big project at work. Hope to resolve this soon

@neontorrent
Copy link

neontorrent commented Jul 16, 2020

Using Intellij 2020.3, sbt 1.3.13, check "Download: Library sources", regardless of Intellij setting "Allow overriding sbt version", it gives error:

[error] (updateSbtClassifiers) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] http://localnet/xx/xx-1.0-sources.jar: download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: http://localnet/xx/xx-1.0-sources.jar (Server returned HTTP response code: 403 for URL: http://localnet/xx/xx-1.0-sources.jar) while downloading http://localnet/xx/xx-1.0-sources.jar
[error] Total time: 1 s, completed 16-July-2020, 5:15:09 PM
[info] shutting down sbt server

Currently workaround:

  • In intellij changing sbt.version=1.1.1 and using internal build
  • In sbt console using 1.3.13

EDIT

Setting useCoursier := false and updateConfiguration := updateConfiguration.value.withMissingOk(true) does not work either

@dispalt
Copy link

dispalt commented Jul 17, 2020

Anyone who is watching this thread, I followed @alexarchambault's instructions above in my own repo. So once I ran ./sbt-cs -C--plugin-version=2.0.0-RC6-6 and did updateSbtClassifier and then went back to my operating system's sbt command it started working.

@Hardik-Kandpal
Copy link

@dispalt
@alexarchambault
I am new to scala and sbt and have been struggling with this for quite some time now.
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
javac 14
sbt 1.3.8

Constantly facing
some_name.jar: wrong checksum: C:\sm2\harbor\null\Coursier\cache...\somename.jar expected 'SHA-1 this' got 'that'

I am working on a windows environment.
Can you please suggest what changes should I make in IntelliJ or elsewhere to get this working.

@almothafar
Copy link

almothafar commented Jul 23, 2020

Personally I can confirm I got no issues anymore with 1.3.13, while there is always an issue starting from 1.3.7 until 1.3.11 (that what I can confirm).

Of IntelliJ users, make sure you allow overriding sbt version:
image

Then update sbt in build.properties file to 1.3.13.
Delete target and project/project and project/target and delete null folder if you have it, then restart IDE or Just restart sbt shell (for reimport)

@neontorrent
Copy link

Personally I can confirm I got no issues anymore with 1.3.13, while there is always an issue starting from 1.3.7 until 1.3.11 (that what I can confirm).

Of IntelliJ users, make sure you allow overriding sbt version:

Then update sbt in build.properties file to 1.3.13.
Delete target and project/project and project/target and delete null folder if you have it, then restart IDE or Just restart sbt shell (for reimport)

When you check "Allow overriding sbt version", it means Intellij will pick the latest version and whatever you set in build.properties will be ignored. So you likely is actually running a sbt version higher than 1.3.13. Check the actual version when you run sbt shell.

@almothafar
Copy link

almothafar commented Jul 29, 2020

Personally I can confirm I got no issues anymore with 1.3.13, while there is always an issue starting from 1.3.7 until 1.3.11 (that what I can confirm).
Of IntelliJ users, make sure you allow overriding sbt version:
Then update sbt in build.properties file to 1.3.13.
Delete target and project/project and project/target and delete null folder if you have it, then restart IDE or Just restart sbt shell (for reimport)

When you check "Allow overriding sbt version", it means Intellij will pick the latest version and whatever you set in build.properties will be ignored. So you likely is actually running a sbt version higher than 1.3.13. Check the actual version when you run sbt shell.

Actually no, when you run IntelliJ sbt shell they run their internal sbt version for that shell, if you want to run your own you check this box to make shell run your version, you can be sure about this by changing your build.properties, so it will clearly say that for you in the events tab.
IntelliJ runs its own version (last time I checked it was 1.3.8) and when you check this box, it will get the version from build.properties.

@neontorrent
Copy link

Personally I can confirm I got no issues anymore with 1.3.13, while there is always an issue starting from 1.3.7 until 1.3.11 (that what I can confirm).
Of IntelliJ users, make sure you allow overriding sbt version:
Then update sbt in build.properties file to 1.3.13.
Delete target and project/project and project/target and delete null folder if you have it, then restart IDE or Just restart sbt shell (for reimport)

When you check "Allow overriding sbt version", it means Intellij will pick the latest version and whatever you set in build.properties will be ignored. So you likely is actually running a sbt version higher than 1.3.13. Check the actual version when you run sbt shell.

Actually no, when you run IntelliJ sbt shell they run their internal sbt version for that shell, if you want to run your own you check this box to make shell run your version, you can be sure about this by changing your build.properties, so it will clearly say that for you in the events tab.
IntelliJ runs its own version (last time I checked it was 1.3.8) and when you check this box, it will get the version from build.properties.

No It's the opposite of that:

image

@jastice
Copy link
Contributor

jastice commented Sep 22, 2020

I take it this is fixed in 1.4.0-RC1?

@Daenyth
Copy link

Daenyth commented Sep 22, 2020

On one of my projects suffering from this error using 1.3.10, updating sbt.version to 1.4.0-RC1 makes it no longer fail

@neontorrent
Copy link

I can still reproduce this issue with Intellij 2020.2 Download library sources on and sbt 1.4.0-RC1

@danielRicardo
Copy link

danielRicardo commented Oct 21, 2020

I am still having the same issue.
Running:

  • IntelliJ 2020.2.3
  • SBT 1.4.1
  • AdoptOpenJDK 11

@Hardik-Kandpal
Copy link

I am still having the same issue.
Running:

  • IntelliJ 2020.2.3
  • SBT 1.4.1
  • AdoptOpenJDK 11

It seemed some network specific problem in my case.
Look for some "error fetching artifact from..." sort of log for the same package
You can manually download and put them in the path it is complaining for.
(That worked for me back then)

@amichalowski
Copy link

Same issue on Windows:
intelliJ 2020.3.2
SBT 1.4.7
GraalVM Community Java 11.0.10

as workaround I've removed jars from local maven repository (described here: #5374 ) and works for me.

@almothafar
Copy link

almothafar commented Feb 7, 2021

To be honest, this issue and how they ignoring these kinds of critical issues cross 15 versions (since 1.3.7 until now 1.4.7) and not re-open #5374 give me more reasons to totally trash sbt from my recommendation, personally in my company 100% I'm going to gradle or maven next.

Spring Boot, here I come.

@neontorrent
Copy link

I agree. This is breaking bug and it should have been priotitized higher than other features. Somehow it is not getting any attention.

@eed3si9n
Copy link
Member

eed3si9n commented Feb 7, 2021

There's no "they". As far as I know, I'm the only person who monitors sbt issues to triage, and I've been ignoring this issue because with all the comments and history, it's not clear to me what exactly is the problem here.

The original reproduction step says to use sbt new playframework/play-scala-seed.g8. I've checked downloading sbt sources, and I'm able to load the project using IntelliJ, and jump to implementation from build.sbt.

@neontorrent
Copy link

@eed3si9n People are talking about a related issue that has the same error message (but different causes I guess). I was referring to the issue:

Using Intellij 2020.3, sbt 1.3.13, check "Download: Library sources", regardless of Intellij setting "Allow overriding sbt version", it gives error

(when there's a library dependency with only binary jar but no source)

I can create a new issue for this if you prefer. If you can point out where the issue in the code, I can try to help to create a PR (it is hard for me to find myself as I am not familiar with the code base). Community help are always there just need to ask.

@eed3si9n
Copy link
Member

eed3si9n commented Feb 7, 2021

Yea. If let's close this and start a new one with actual repro steps.
If #5374 (comment)

disabling local maven repo in ~/.sbt/repositories

is listed as a workaround, it seems like we're dealing with different issue, like local proxy actually not configured to handle Ivy layout repositories.

@eed3si9n eed3si9n closed this as completed Feb 7, 2021
tgodzik added a commit to tgodzik/bloop that referenced this issue Nov 14, 2023
Looks like a bug that was present long time ago in sbt. I think it might be related to sbt/sbt#5501

Running update manually fixes things.
tgodzik added a commit to tgodzik/bloop that referenced this issue Nov 14, 2023
Looks like a bug that was present long time ago in sbt. I think it might be related to sbt/sbt#5501

Running update manually fixes things.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/ide IntelliJ or Metals integration area/library_management library management Blocked on Upstream Bug needs info Needs more information to take further actions.
Projects
None yet
Development

No branches or pull requests