Search code examples
mavenwindows-10sbtcucumbercoursier

java.nio.file.InvalidPathException while resolving sbt project


Great fan of Scala, but SBT keeps giving me tooth aches in places without teeth. Usually I manage, but this one has me somewhat baffled. Can anyone help me with the following:

TL/DR

While re-importing my sbt-project, I encountered the following error.

[error] (update) java.nio.file.InvalidPathException: Illegal char < > at index 90: C:\Users\\-username-\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\io\cucumbe r\cucumber-junit\5.7.0\cucumber-junit-5.7.0.pom.lock

It seems that the import encountered some corrupt path including a tab character while resolving the cucumber dependency. The weird thing is, that this was a re-import; it imported fine before. Also, the actual path C:\Users\\-username-\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\io\cucumbe r\cucumber-junit\5.7.0\ cannot be found, neither via the explorer or the shell.

The error first occurred while importing the project into Intellij, but using SBT via the shell yielded the same.

Details below.

Does anyone know how to:
- solve this?
- prevent it from happening again?

Project can be found here

Full SBT log:

[info] Loading global plugins from C:\Users\-username-\.sbt\1.0\plugins  
[info] Loading settings for project sandbox-build from plugins.sbt ...  
[info] Loading project definition from C:\coding\modules\scala\sandbox\project  
[info] Loading settings for project sandbox from build.sbt ...  
[info] Set current project to sandbox (in build file:/C:/coding/modules/scala/sandbox/)  
[error] java.nio.file.InvalidPathException: Illegal char <    > at index 90: C:\Users\-username-\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\io\cucumbe  r\cucumber-junit\6.0.0-RC2\cucumber-junit-6.0.0-RC2.pom.lock  
[error]   at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)  
[error]   at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)  
[error]   at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)  
[error]   at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)  
[error]   at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)  
[error]   at java.base/java.io.File.toPath(File.java:2311)  
[error]   at lmcoursier.internal.shaded.coursier.cache.CacheLocks$.withLockOr(CacheLocks.scala:35)  
[error]   at lmcoursier.internal.shaded.coursier.cache.FileCache.$anonfun$download$32(FileCache.scala:508)  
[error]   at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)  
[error]   at scala.util.Success.$anonfun$map$1(Try.scala:255)  
[error]   at scala.util.Success.map(Try.scala:213)  
[error]   at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)  
[error]   at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)  
[error]   at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)  
[error]   at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)  
[error]   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)  
[error]   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)  
[error]   at java.base/java.lang.Thread.run(Thread.java:832)  
[error] (update) java.nio.file.InvalidPathException: Illegal char <   > at index 90: C:\Users\-username-\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\io\cucumbe  r\cucumber-junit\6.0.0-RC2\cucumber-junit-6.0.0-RC2.pom.lock  
[error] Total time: 1 s, completed 4 jun. 2020 13:57:57```  

Already tried to

  • clear the Coursier cache by deleting the C:\Users\-username-\AppData\Local\Coursier\cache\ directory
  • clear the project by deleting the ./target and ./project/target directories
  • update the offending Cucumber dependencies to 6.0.0-RC2

It seems that the lock file still exists somewhere and SBT can't re-download itself?


Solution

  • As the exception reports there are 6 spaces or a tab to many. Exactly the ones in your build.sbt file on line 52: "io.cucumbe\t r". Happy programming!