Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filename too long sbt

Tags:

scala

sbt

I am getting an error saying I have a file that is too long in sbt.

 [info] Compiling 29 Scala sources to /home/chris/dev/suredbits-core/target/scala-2.11/classes...
    [error] File name too long
    [error] one error found
    [error] (compile:compile) Compilation failed
    [error] Total time: 7 s, completed Feb 17, 2015 8:10:25 AM

How do I find out which file is too long so I can shorten the filename? I have added the compiler flag -Xmax-classfile-name and set it to 254.

like image 428
Chris Stewart Avatar asked Feb 17 '15 16:02

Chris Stewart


3 Answers

If your /home is an encrypted file system (e.g. LUKS), you might run into this issue.

Setting max-classfile-name to 254 is the default (or it might be 255) - so you're not reducing it much. You should probably be considering something closer to a max length of 70 - 100. You can set it for all your projects by creating ~/.sbt/0.13/local.sbt with the scalac override:

scalacOptions ++= Seq("-Xmax-classfile-name","78")
like image 169
Brett Avatar answered Oct 06 '22 22:10

Brett


This is how I solved my problem

mkdir /tmp/myproject-target
cd ~/workspace/myproject
rm -rf target
ln -s /tmp/myproject-target target
like image 40
Chris Stewart Avatar answered Oct 06 '22 23:10

Chris Stewart


I encountered this problem in IntelliJ Ultimate 2016.1.2 (which resembles Intellij 14). I solved it by setting:

-Xmax-classfile-name 78 

In File > Settings... > Build, Execution, Deployment > Compiler > Scala Compiler > Additional Compiler Options.

NOTE: there is a space between the option name and its value ("78"), not an equals sign.

like image 7
Adrian Redgers Avatar answered Oct 06 '22 22:10

Adrian Redgers