在 Vagrant 同步文件夹内的 SBT / Typesafe 激活器中不允许操作

Operation Not Permitted in SBT / Typesafe Activator inside Vagrant Synced Folder

我正在 运行通过 Typesafe Activator 在 Vagrant / Virtualbox 提供的 Ubuntu 机器上使用 SBT。主机是Windows8.

我正在尝试通过输入命令 ./activator(或 sudo ./activator)编译 Play 项目 https://github.com/markisus/ScalaPoker,然后在将存储库克隆到机器。 repo 位于同步文件夹中。我认为这是问题的根源。

我在以下位置收到错误 Operation not permitted

[info] Compiling 34 Scala sources to /home/vagrant/sp2/ScalaPoker/ScalaPokerEngine/target/scala-2.11/classes...
[error] Operation not permitted
[error] one error found
[error] (ScalaPokerEngine/compile:compile) Compilation failed
[error] Total time: 91 s, completed Jan 26, 2015 4:29:22 AM  

我不确定具体哪个操作是不允许的。该项目在我的主机上编译得很好。

运行 last, 我得到

[debug] Running cached compiler e13c8f, interfacing (CompilerInterface) with Scala compiler version 2.11.1
[debug] Calling Scala compiler with arguments  (CompilerInterface):
[debug]         -bootclasspath
[debug]         /usr/lib/jvm/java-6-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jfr.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/netx.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/plugin.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/classes:/root/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.1.jar
[debug]         -classpath
[debug]         /home/vagrant/sp2/ScalaPoker/ScalaPokerEngine/target/scala-2.11/classes
[error] Operation not permitted
[error] one error found
[debug] Compilation failed (CompilerInterface)
[error] (ScalaPokerEngine/compile:compile) Compilation failed

看来我不被允许 运行 Scala 编译器?我不确定 Activator 将 Scala 编译器放在哪里,现在我卡住了。

可以在此处找到虚拟机的设置(Vagrantfile 和 salt 文件)https://github.com/markisus/ActivatorVagrant/tree/scalapoker

是的,当您使用同步文件夹时,安装在来宾中的文件夹会继承主机底层文件系统的限制。

一方面,可能无法创建符号链接。

此类错误的另一个常见原因是 Windows 文件系统默认不允许并发访问文件。例如,您不能删除仍在由另一个进程打开的文件(这在 Linux 上没有问题)。

在 Windows 上,反病毒软件通常会出现这种情况,它会以独占访问权限打开文件,以便在执行或加载文件并对系统造成损害之前对其进行检查。如果防病毒软件仍在分析这些文件,其他进程(包括 VM 内的 运行ning 进程)在尝试访问这些文件时会收到错误。

您可以尝试在编译阶段通过 运行ning sysinternal 的 ProcessMonitor 进一步检查主机上的问题。查看共享文件夹中的文件出现了哪些错误。提示:对文件路径使用开头为过滤器,以便只包含特定文件夹的事件。

在guest里面,你可以运行strace中的activator,例如:

$ strace -f -ocompile.log ./activator compile

查看 运行 之后的 compile.log 文件以获取一些线索。

另一种解决方案可能是在 vagrant:

中更改 sbttarget 目录
$ sbt
sbt> set target:=file("/home/vagrant/orca-target/")
sbt> ;test;run