Why is SBT 0.7.7 not working correctly on my Linux system? (case details inside)

First of all, I would like to ask you to correct your question if something better comes to your mind.

Take the Lift REST web service example from David Pollack's Simply Lift book here .

If I open the Windows console (Windows XP SP3, all updates, Oracle JDK 7) inside the directory and run "sbt" (sbt.bat), everything will be fine. But in case I try to do the same (but using "./sbt") on Linux (XUbuntu 11.10, OpenJDK 6, OpenJDK 7, Oracle JDK 7 (tried everything)), SBT returns (instead of switching to SBT console mode ), since he did the job. This means that the command can be simply ./sbt immediately returned (after completion of automatic project maintenance) or there will be ./sbt jetty-run - it simply starts the web server and immediately disconnects it.

In addition, the web service that I developed for my compilation project works fine on Windows, but cannot be compiled (using ./sbt compile ) on Linux (using the same version of SBT). The error "source file" /.../src/main/scala/code/lib/FooBar.scala;src/main/scala/bootstrap/liftweb/Boot.scala 'could not be found ", where" FooBar.scala " is an object in which I do all the services (directly called from Boot.scala).

Any ideas on what could be causing and how to fix it?

UPDATE: The cause of the first problem (SBT returning to the shell instead of offering the SBT console) it seems that the file was extracted from Windows and had CR + LF instead of just ending the LF line, Solving source files that were not found , just used the clean command to recompile from scratch.

+6
source share
3 answers

The cause of the first problem (SBT returning to the shell instead of offering the SBT console), it seems that the file was extracted on Windows and had CR + LF instead of just ending LF. Solving source files that were not found simply used the clean command to recompile from scratch.

+2
source

First, when you simply type:

java -jar sbt-launch.jar

directly from the command line in the folder where sbt-launch.jar is located. If sbt-launch.jar is in the same folder as the sbt script, you can edit the script to look like this:

 #!/bin/sh test -f ~/.sbtconfig && . ~/.sbtconfig java -Xmx512M ${SBT_OPTS} -jar dirname $0/sbt-launch.jar " $@ " 

The dirname $ 0 construct returns the full path to the sbt script folder without the script file name. Using the $ SBT_OPTS variable allows you to experiment with various JVM parameters, for example:

SBT_OPTS = "- Xss2M -XX: + CMSClassUnloadingEnabled"

Although I would wait with these parameters, since they probably are not a problem here (however, do not forget to add CMSClassUnloadingEnable later when SBT is working, as this ensures that Scala class definitions are generated dynamically when run SBT is unloaded when they are not used, which prevents memory errors - see more details here ):

Also consider using one of

-Djline.terminal = scala.tools.jline.UnixTerminal

or even

-Djline.terminal = jline.UnsupportedTerminal

in SBT_OPTS .

Finally, what happens if you try never to use the SBT version? (you can try running the SBT erase version 0.11 found here https://github.com/lacy/lift-quickstart ).

+1
source

Replace Linux script with:

 #!/bin/bash java -Xmx512M -jar `dirname $0`/sbt-launch.jar " $@ " 

In settings:

Your script sets Xss (stream stack size). On Linux, you sometimes need to change (via ulimit) the settings for the stack on the stream (ulimit -s), since you may have SO level conflicts that can trigger "kill" in your threads. If you have a very important reason to set this flag, just remove it and let the JVM handle it.

You might also want to put Xms instead of Xss, although then 2M will make this flag inappropriate (too small a bunch to be practical)

The -XX: + CMSClassUnloadingEnabled flag allows the GC to shift Perm space. This is not necessary for sbt. As you can read here , PermGen options will only delay PermGen problems, so if you have problems with PermGen when starting Jetty, just add more PermGen via -XX: MaxPermSize

0
source

Source: https://habr.com/ru/post/899281/


All Articles