由于编译器使用 Scala 2.9.2 为我在 Scala 类中的一个闭包提供的文件名长度,我遇到了问题
CurrencyInitializer$$anonfun$com$gottex$gottware$server$startup$initializers$impl$currency$CurrencyInitializer$$updateDepositEquivalentBonds$1.class
我对这个文件名的问题是,我正在通过 SSH gui 通过 Linux 服务器上传一个包含我所有编译类的文件夹,但这失败了。
private def updateDepositEquivalentBonds(currency: Currency) {
val depositEquivalentBonds = gottwareDataSource.space.readAllWithCurrency(classOf[DepositEquivalentBondImpl], currency)
for (depositEquivalentBond <- depositEquivalentBonds) depositEquivalentBond.updateFromDeposit(gottwareDataSource.space)
if (depositEquivalentBonds.length > 0) {
gottwareDataSource.space.writeMultiple(depositEquivalentBonds, Lease.FOREVER,
UpdateModifiers.UPDATE_OR_WRITE | UpdateModifiers.NO_RETURN_VALUE)
gottwareDataSource.space.writeMultiple(AskBidSpread.newInstances(depositEquivalentBonds.toArray[SecurityImpl]), Lease.FOREVER, UpdateModifiers.UPDATE_OR_WRITE | UpdateModifiers
.NO_RETURN_VALUE)
}
}
令人惊讶的是,这是产生长文件名的代码。我可以在编译器上做些什么来防止这种情况发生?
最佳答案
设置 max-classfile-name
scala 编译器调用上的参数以缩短文件名。
在 POM 中,要获取不超过 144 个字符的文件名(Crypt FS 大小限制),配置如下
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>2.9.2</scalaVersion>
<args>
<arg>-Xmax-classfile-name</arg>
<arg>144</arg>
</args>
</configuration>
</plugin>
编译源设置引用link (会过时)
关于Scala 闭包文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15524418/