Skip to content

Deleting cached jars triggers NoSuchFileException #821

Open
@olafurpg

Description

Steps to reproduce

  • sbt bloopInstall a project
  • compile works as expected
  • rm -rf the cache location for downloaded jars that are referenced in .bloop/*.json files
  • bloop compile proje<TAB>
$ bloop compile fron<TAB>
java.nio.file.NoSuchFileException: /Users/olafurpg/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.7/scala-library-2.10.7.jar
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
	at java.nio.file.Files.readAttributes(Files.java:1737)
	at bloop.ScalaInstance.$anonfun$hashCode$1(ScalaInstance.scala:65)
	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:39)
	at scala.collection.TraversableLike.map(TraversableLike.scala:237)
	at scala.collection.TraversableLike.map$(TraversableLike.scala:230)
	at scala.collection.AbstractTraversable.map(Traversable.scala:108)
	at bloop.ScalaInstance.<init>(ScalaInstance.scala:61)
	at bloop.ScalaInstance$.newInstance$1(ScalaInstance.scala:109)
	at bloop.ScalaInstance$.$anonfun$apply$7(ScalaInstance.scala:114)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at bloop.ScalaInstance$.apply(ScalaInstance.scala:114)
	at bloop.data.Project$.$anonfun$fromConfig$1(Project.scala:110)
	at scala.Option.flatMap(Option.scala:188)
	at bloop.data.Project$.fromConfig(Project.scala:106)
	at bloop.data.Project$.fromBytesAndOrigin(Project.scala:170)

In Metals, this error manifests as a timeout exception during the BSP initialize handshake.

I expected Bloop to report an error in the cli like this instead

$ bloop compile frontend
[E] .bloop/frontend.json references missing file /Users/olafurpg/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.7/scala-library-2.10.7.jar

In BSP, I expect Bloop to initialize but ignore build targets that reference missing jars. It could report errors via logMessage instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugA defect or misbehaviour.build serverAny issue or pull request that has to do with hot compilers or BSP.task / compile

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions