sbt执行期间出错:来自Windows命令提示符的java.nio.channels.overlappingfilelockexception

时间:2013-11-29 15:37:10

标签: sbt

我正在尝试在Windows 7上安装sbt但是测试它,我收到以下错误:

java.nio.channels.OverlappingFileLockException
    at sun.nio.ch.SharedFileLockTable.checkList(Unknown Source)
    at sun.nio.ch.SharedFileLockTable.add(Unknown Source)
    at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source)
    at java.nio.channels.FileChannel.tryLock(Unknown Source)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:88)
    at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:81)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
    at xsbt.boot.Using$.withResource(Using.scala:11)
    at xsbt.boot.Using$.apply(Using.scala:10)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
    at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:52)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at xsbt.boot.Update.apply(Checks.java:100)
    at xsbt.boot.Launch.update(Launch.scala:266)
    at xsbt.boot.Launch.retrieve$1(Launch.scala:136)
    at xsbt.boot.Launch$$anonfun$3.apply(Launch.scala:144)
    at scala.Option.getOrElse(Option.scala:108)
    at xsbt.boot.Launch$$anon$2.call(Launch.scala:129)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
    at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:81)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
    at xsbt.boot.Using$.withResource(Using.scala:11)
    at xsbt.boot.Using$.apply(Using.scala:10)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
    at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:52)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at xsbt.boot.Launch.locked(Launch.scala:165)
    at xsbt.boot.Launch.app(Launch.scala:82)
    at xsbt.boot.Launch.app(Launch.scala:80)
    at xsbt.boot.Launch$.run(Launch.scala:51)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
    at xsbt.boot.Launch$.launch(Launch.scala:60)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Boot$.runImpl(Boot.scala:31)
    at xsbt.boot.Boot$.main(Boot.scala:20)
    at xsbt.boot.Boot.main(Boot.scala)
    at SbtJansiLaunch.main(SbtJansiLaunch.java:4)
Error during sbt execution: java.nio.channels.OverlappingFileLockException

这似乎与我根据这篇文章访问我的远程HOME驱动器这一事实有关: https://groups.google.com/forum/#!topic/simple-build-tool/lJvOvZ5RUwE

我尝试按照他们的建议,但我从未找到任何sbt.boot.properties文件。我还尝试通过以下方式覆盖启动和工作目录:

 sbt -sbt-dir C:\my\new\home -sbt-boot C:\my\new\home

你们中的任何一个人是否已经解决了所有这些问题并且可以逐步解决这个问题?

1 个答案:

答案 0 :(得分:0)

好的,所以我遇到了同样的问题。 sbt.boot.properties文件驻留在sbt-launch.jar存档中。使用winzip或7zip等存档工具打开它,然后查看文件夹/ sbt,您将看到sbt.boot.properties文件。

当前版本如下所示

[scala]
  version: ${sbt.scala.version-auto}

[app]
  org: ${sbt.organization-org.scala-sbt}
  name: sbt
  version: ${sbt.version-read(sbt.version)[0.13.6]}
  class: ${sbt.main.class-sbt.xMain}
  components: xsbti,extra
  cross-versioned: ${sbt.cross.versioned-false}
  resources: ${sbt.extraClasspath-}

[repositories]
  local
  typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
  maven-central

[boot]
  directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}

[ivy]
  ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}
  checksums: ${sbt.checksums-sha1,md5}
  override-build-repos: ${sbt.override.build.repos-false}
  repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}

确保在[boot]部分添加属性锁定,否则会出现其他错误。所以最终看起来应该是这样的:

[scala]
  version: ${sbt.scala.version-auto}

[app]
  org: ${sbt.organization-org.scala-sbt}
  name: sbt
  version: ${sbt.version-read(sbt.version)[0.13.6]}
  class: ${sbt.main.class-sbt.xMain}
  components: xsbti,extra
  cross-versioned: ${sbt.cross.versioned-false}
  resources: ${sbt.extraClasspath-}

[repositories]
  local
  typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
  maven-central

[boot]
  directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
  lock: false

[ivy]
  ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}
  checksums: ${sbt.checksums-sha1,md5}
  override-build-repos: ${sbt.override.build.repos-false}
  repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}

另一个关注点也是他们在Google群组中所说的话。不要同时运行两个sbt进程,因为此参数可能会导致不一致。