2

I published some libraries using sbt publishLocal it worked and published to my ~/.ivy2/local dir.

I then have a project that depends on these libraries but sbt update can't find them.

specifically, my project has these dependencies:

lazy val myDependencies = commonDependencies ++ Seq(
    "my.corp"  %% "lib1" % "1.0.1-SNAPSHOT" withSources () withJavadoc (),
    "my.corp"  %% "lib2" % "2.0.2-SNAPSHOT" withSources () withJavadoc ()
  )

sbt update has this error:

[error] (services / update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] file:////home/myuser/.ivy2//local/my.corp/lib1_2.12/1.0.1-SNAPSHOT/jars/lib1.jar: not found: /home/myuser/.ivy2//local/my.corp/lib1_2.12/1.0.1-SNAPSHOT/jars/lib1.jar
[error] file://///home/myuser/.ivy2//local/my.corp/lib2_2.12/2.0.2-SNAPSHOT/jars/lib2.jar: not found: /home/myuser/.ivy2//local/my.corp/lib2_2.12/2.0.2-SNAPSHOT/jars/lib2.jar

when I look in the dir I can see the published jars but their name has the scala version appended, which is why the update resolving fails, I think :

$ ls /home/myuser/.ivy2/local/my.corp/lib1_2.12/1.0.1-SNAPSHOT/jars
lib1_2.12.jar  lib1_2.12.jar.md5  lib1_2.12.jar.sha1

$ ls /home/myuser/.ivy2/local/my.corp/lib2_2.12/2.0.2-SNAPSHOT/jars
lib2_2.12.jar  lib2_2.12.jar.md5  lib2_2.12.jar.sha1

If I publish to a repo for real I can resolve the libs.

Does anyone know the sbt incantation to fix this? ;-)

Cheers Karl

Update:- I think coursier is the problem, not sure how to tell it to look for lib2_2_12.jar. Could it have a bad cached reference?

Caused by: lmcoursier.internal.shaded.coursier.cache.ArtifactError$NotFound: not found: /home/myuser/.ivy2/local/my.corp/lib2_2.12/2.0.2-SNAPSHOT/jars/lib2.jar

Update:- disabling coursier worked from the sbt REPL I can run

sbt:my-project> set ThisBuild / useCoursier := false

and then

sbt:my-project> update

and that worked, but setting it back to true update failed again, so this looks like a coursier issue.

Update: coursier fetch from the command line worked!!

coursier fetch my.corp::lib1:1.0.1-SNAPSHOT --no-default -r central -r ivy2Local

downloaded the transitive dependencies and found my jar in my local ivy2 dir

so this is back to looking like an sbt - coursier interaction issue

4

1 回答 1

1

我刚刚遇到了这个问题,在旧的工作版本和这个非工作版本之间存在很多差异之后,我发现它withSources()触发了 sbt 和/或 coursier 中的错误。

于 2020-07-15T19:05:50.620 回答