SBT尝试访问不存在的文件

时间:2016-04-19 12:29:18

标签: scala cygwin sbt

我最近开始在我的Windows机器上使用Cygwin作为开发环境但是当我尝试打包或发布这个项目时,我收到以下错误

➜  admingui-protocol git:(master) sbt clean packageBin
[info] Loading project definition from C:\cygwin64\test\admingui-protocol\project
[info] Updating {file:/C:/cygwin64/test/admingui-protocol/project/}admingui-protocol-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to protocol (in build file:/C:/cygwin64/test/admingui-protocol/)
[success] Total time: 0 s, completed Apr 19, 2016 10:01:33 PM
[info] Updating {file:/C:/cygwin64/test/admingui-protocol/}root...
[info] Resolving jline#jline;2.12.1 ...
java.io.FileNotFoundException: C:\cygwin64\test\admingui-protocol\target\resolution-cache\au.com.bluer\resolved.xml.xml (The filename, directory name, or volume label syntax is incorrect)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter.write(XmlModuleDescriptorWriter.java:69)
        at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter.write(XmlModuleDescriptorWriter.java:61)
        at org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.toIvyFile(DefaultModuleDescriptor.java:562)
        at sbt.ResolutionCache.saveResolvedModuleDescriptor(ResolutionCache.scala:61)
        at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:243)
        at org.apache.ivy.Ivy.resolve(Ivy.java:517)
        at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:279)
        at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
        at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
        at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
        at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
        at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
        at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
        at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
        at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
        at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
        at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
        at xsbt.boot.Using$.withResource(Using.scala:10)
        at xsbt.boot.Using$.apply(Using.scala:9)
        at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
        at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
        at xsbt.boot.Locks$.apply0(Locks.scala:31)
        at xsbt.boot.Locks$.apply(Locks.scala:28)
        at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
        at sbt.IvySbt.withIvy(Ivy.scala:127)
        at sbt.IvySbt.withIvy(Ivy.scala:124)
        at sbt.IvySbt$Module.withModule(Ivy.scala:155)
        at sbt.IvyActions$.updateEither(IvyActions.scala:165)
        at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369)
        at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365)
        at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399)
        at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397)
        at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
        at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402)
        at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396)
        at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
        at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419)
        at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348)
        at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[error] (*:update) java.io.FileNotFoundException: C:\cygwin64\test\admingui-protocol\target\resolution\resolved.xml.xml (The filename, directory name, or volume label syntax is incorrect)
[error] Total time: 0 s, completed Apr 19, 2016 10:01:34 PM

我要构建和打包的其他项目很好,但是这台机器总是失败,如果我尝试使用Linux系统它可以正常工作。贝娄是我的构建文件

import com.trueaccord.scalapb.{ScalaPbPlugin => PB}

name := "protocol"

version := Process("git describe --tags --abbrev=5", baseDirectory.value).!!.replace("\n", "")

organization := "au.com.bluereef.sonar.gui"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
        "com.typesafe.slick"                                                            %% "slick"                            % "3.1.1",
        "org.postgresql"                                                                %  "postgresql"                         % "9.4.1208"
)

PB.protobufSettings

PB.javaConversions in PB.protobufConfig := true

PB.runProtoc in PB.protobufConfig := (args =>
  com.github.os72.protocjar.Protoc.runProtoc("-v300" +: args.toArray))

lazy val root = (project in file(".")).
  enablePlugins(BuildInfoPlugin).
  settings(
    buildInfoKeys := Seq[BuildInfoKey](version),
    buildInfoPackage := "au.com.bluereef.sonar.gui.protocol"
  )

如果我注释掉version行,它就会重新开始工作。有关如何使其正常工作的任何线索?

编辑:我的解决方案是使用sbt-git插件做了同样的事情,但我仍然感兴趣为什么会出现这个错误

1 个答案:

答案 0 :(得分:0)

我能够使用相同的sbt配置,替换&#34; \ r \ n&#34;用&#34;&#34;。

version := "svn info -r HEAD --show-item=revision".!!.replace("\r\n", "")