我想在Windows10中使用sbt
创建xcopy
任务来复制目录和文件。我收到了以下错误。这是什么错误?
val copyCommonFilesInPublicKey = taskKey[Int]("Copies files in ../common/css and ../common/javascripts in public/stylesheet/common and public/javascripts/common")
copyCommonFilesInPublicKey := {
val copyCSS = Process(s"xcopy /i ../common/css public/stylesheets/common").!< //I had to use / instead of \ in path
println(s"copy CSS returned ${copyCSS}")
val copyJS = Process(s"xcopy /i ../common/javascripts public/javascripts/common").!<
println(s"copy JS returned ${copyJS}")
copyJS
}
错误
Invalid number of parameters
copy CSS returned 4
Invalid number of parameters
copy JS returned 4
[success] Total time: 0 s, completed 18-Jan-2018 15:03:32
命令在cmd
上正常运行。我怀疑这可能是/i
的问题,因为我无法通过使用\
提供路径来运行命令。我尝试将/i
更改为\\i
但我收到同样的错误。
答案 0 :(得分:0)
您需要拆分参数:
val copyCommonFilesInPublicKey = taskKey[Int]("Copies files in ../common/css and ../common/javascripts in public/stylesheet/common and public/javascripts/common")
copyCommonFilesInPublicKey := {
val copyCSS = Process(Seq("xcopy", "/i", "..\\common\\css", "public\\stylesheets\\common")).!<
println(s"copy CSS returned ${copyCSS}")
val copyJS = Process(Seq("xcopy", "/i", "..\\common\\javascripts", "public\\javascripts\\common")).!<
println(s"copy JS returned ${copyJS}")
copyJS
}