dwijnand / sbt-extras Goto Github PK
View Code? Open in Web Editor NEWA more featureful runner for sbt, the simple/scala/standard build tool
License: Other
A more featureful runner for sbt, the simple/scala/standard build tool
License: Other
When trying to use this with older versions of sbt, sbt fails with:
[error] Not a valid command: warn
[error] Not a valid project ID: warn
[error] Not a valid configuration: warn
[error] Not a valid key: warn (similar: run, clean, watch)
[error] warn
[error] ^
The 0.7.7 launcher is 404, as in fact is the entirety of simple-build-tool.googlecode.com
, but the test for sbt 0.7.x passes anyway. It is not immediately clear to me why, but it is not a promising sign the tests are testing.
Environment: Arch Linux, java-10-openjdk, sbt-extras daa7953
When running sbt
without arguments, I get this:
$ sbt
/home/lars/bin/sbt: line 205: [[: .: syntax error: operand expected (error token is ".")
But sbt
proceeds to start as normal.
The logic that picks up JAVA_HOME
and silently sets javaHome
won't work for 0.13.0 as warn
wasn't available(?)
$ sbt
[info] Loading global plugins from /Users/dnw/.sbt/0.13/plugins
[info] Loading project definition from /Users/dnw/Desktop/t
[info] Set current project to t (in build file:/Users/dnw/Desktop/t/)
[error] Not a valid command: warn (similar: start)
[error] Not a valid project ID: warn
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: warn (similar: run, clean, watch)
[error] warn
[error] ^
More info available in ~/.sbt/boot/update.log
Contrary to what the usage options tell me the sbt
script currently doesn't honor the env settings JAVA_OPTS
and SBT_OPTS
.
(Not even the default_jvm_opts
or default_sbt_opts
make it to the actual command line run.)
Hi @paulp, this issue is to make sbt-extras
and sbt
work together correctly to fix the problem identified here: sbt/sbt#1117
Specifically, would changing sbt-extras
to always use the latest sbt
launcher jar available, as recommended here (sbt/sbt#1117 (comment)), fix this issue?
travis-ci/travis-ci#7212 reports that sbt
, which Travis CI uses in Scala builds, does not exit with nonzero status code when there are errors.
Could you take a look?
Thank you.
It would be convenient if given an sbt.version
that ends with -SNAPSHOT
the sbt-launch.jar
would be automatically picked up from ~/.ivy2/local/org.scala-sbt/sbt-launch/${version}/jars/sbt-launch.jar
.
See #120 (comment).
Since f525931 (save stty and trap exit, to ensure echo is reenabled if we are interrupted), sbt-extras script with -batch
mode enabled fails to restore saved stty with following consequences:
0
, which currently makes -batch
mode impossible to use in a build script.As I first would have to learn how "bash trap" mechanism works (and much more!), I preferred to first report this issue. Maybe @paulp (or someone else) will directly know how to fix it. If not, I'd be interested to further discuss the problem and the better way to fix it.
For googlers, the error messages I observed are following:
On Mac OS X (Bash 3.2.48)
restoring stty: ...
stty: stdin isn't a terminal
On Ubuntu Linux (Bash 4.2.25)
restoring stty: ...
stty: standard input: Bad file descriptor
From git history, I guess that this commit is also worth to have a look: f8a0213 (make -batch
works)
This allows attaching a debugger to debug an early part of a program (instead of trying to race the JVM..).
@paulp I'm not sure how to implement this, basically add another flag or parse the -jvm-debug
argument differently.. Do you have any suggestions, please?
Our project needs a specific yet different version of java in each branch, which every user needs to set in their personal .sbtopts
. When moving to your latest release of sbt
(now that this is supported), a large proportion of our team was getting problems because they didn't put a newline at the end of the file so the -java-home
parameter was unable to see the <path>
element.
It would be very useful if the newline at the end of the file was optional.
It would be very useful if it were possible to easily identify the version of the sbt script, for instance when outputting the usage text.
I was thinking perhaps a timestamp would do, enforced by a test that runs (1) only on Travis, and (2) only when testing a pull request (so that it doesn't break git bisect).
Recent versions of the IntelliJ IDEA Scala plugin have a test to see if the Custom SBT is actually a JAR, which means I can no longer just point to /usr/bin/sbt
like I used to...
Which means that for IntelliJ, I have two choices:
sbt
from Community.I don't like either of those choices - any recommendations for using sbt-extras
with IntelliJ?
I typically use Java7 but I have an awkward project that must be compiled/run under a specific version of java 6.
When launching, I have tried both setting JAVA_HOME
and passing -java-home
. This version of java is correctly picked up by sbt and that is indeed the version that a System.getProperty("java.version")
will output.
However, the java files in my project are being compiled by java 7!!
I suspect there is some part of sbt
that is calling out to the javac
binary without respecting the java-home, because when I set
export JAVA_HOME=...
export PATH=$JAVA_HOME/bin:$PATH
sbt
then everything works as expected.
Any ideas?
Trying to get .sbitgnore
to work and I think I'm doing something wrong. I copied your .sbtignore
gist:
ocs (quiet-build *)$ cat ~/.sbtignore
# sbt ignore regexps
Starting sbt with output filtering enabled
^\[info\][ ]+(Resolving|Loading|Done|Attempting|Formatting|Updating)[ ]
^\[info\] Main Scala API documentation
^\[info\].*published[ ]+.*(sources\.jar|javadoc\.jar|\.pom)$
^\[info\].*published ivy to
^\[warn\] Credentials file
^\[info\] Wrote.*[.]pom
This usage is deprecated
Attempting to overwrite
delivering ivy file to
warnings? found$
re[-]run with [-](unchecked|deprecation|feature) for details
model contains[ ]
[ ]delivering[ ]
^Graphviz dot encountered an error when generating the diagram for:
^These are usually spurious errors, but if you notice a persistant error on
^a diagram, please use the -diagrams-debug flag and report a bug with the output
^Graphviz will be restarted...
^Diagrams will be disabled for this run because the graphviz dot tool
^has malfunctioned too many times. These scaladoc flags may help:
^Please note that graphviz package
^[*]+$
^-diagrams-
^$
And the script seems to see it, but nothing is filtered other than the Starting sbt with output filtering enabled
line.
ocs (quiet-build *)$ sbt -x compile
[X] Starting sbt with output filtering enabled.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
[info] Loading global plugins from /Users/rnorris/.sbt/0.13/plugins
[info] Loading project definition from /Users/rnorris/Scala/ocs/project
[info] Set current project to ocs (in build file:/Users/rnorris/Scala/ocs/)
[info] Updating bundle_edu_gemini_util_ssl
[info] Resolved bundle_edu_gemini_util_ssl dependencies
...
Any ideas? Normal bash, MacOS 10.9.5
I often like to remote debug, but having to restart sbt to add -jvm-debug x
is annoying. What I'd like to do is set SBT_OPTS
to include -jvm-debug 0
(to pickup a random port), but still allow for a specific port to be specified at the command line, eg -jvm-debug 5005
for IntelliJ.
Depends on #74 for the full effect to work
In the man page,
-mem <integer>
set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem))
There is no mention about the unit of mem option. Please add a note to tell the unit is MiB.
SBT 0.11.3 Stack Overflows with current default_jvm_options, especially on large Play Framework 2.0.x projects.
Changing the max heap size to 2g and the thread stack size to 2m prevent the overflow from occurring.
The changes around JAVA_HOME and setting javaHome in #95 broke sbt.ScriptMain.
See #95 (comment)
The cygpath is required only for the final java command.
I tried to revive my old cygwin enviro and downloading failed. I tried updating cygwin before submitting a PR and of course updating failed miserably. After I sort it out, I'll attempt a PR from cygwin. Old times!
Would it be possible to allow passing a parameter to override the hardcoded repository specified in make_url? We would like to be able to only use an internal proxy for All The Things. Currently the only solution is to fork entirely.
Thanks!
As of right now, this should default to 2.12.0-M2
.
Hi,
I like sbt-extras. Are there any plans to support SBT 1.X?
Many thanks,
Paul
See. I don't care so much about windows, but I dislike having a "build failing" badge on the main page.
See for instance #125, which is about different flags for sed
between Linux and OS X.
I get the following output if I attempt to run the above command in an empty directory:
mymachine:tmpproject me$ sbt -210 -sbt-create console
Detected sbt version 0.11.2
Using /Users/me/.sbt/0.11.2 as sbt dir, -sbt-dir to override.
[info] Set current project to default-aaeeae (in build file:/private/tmp/tmpproject/)
Setting version to 2.10.0-SNAPSHOT
[info] Set current project to default-aaeeae (in build file:/private/tmp/tmpproject/)
[info] Updating {file:/private/tmp/tmpproject/}default-aaeeae...
[info] Resolving org.scala-lang#scala-library;2.10.0-SNAPSHOT ...
[warn] module not found: org.scala-lang#scala-library;2.10.0-SNAPSHOT
[warn] ==== local: tried
[warn] /Users/me/.ivy2/local/org.scala-lang/scala-library/2.10.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-SNAPSHOT.pom
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-SNAPSHOT.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/private/tmp/tmpproject/}default-aaeeae/*:update: sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[error] Total time: 2 s, completed Apr 30, 2012 5:56:57 PM
When using a jvm-opts file with comments like this:
# Comment 1
# Comment 2
-Xms2048M
-Xmx2048M
-Xss6M
-XX:MaxPermSize=512M
and a command line like this:
sbt -v -jvm-opts conf/jvm-opts clean coveralls doc
this error happens:
No extra sbt options have been defined
Detected sbt version 0.13.0
Using /home/fernando/.sbt/0.13.0 as sbt dir, -sbt-dir to override.
Using jvm options defined in file scripts/conf/jvm-opts
# Executing command line:
/usr/lib/jvm/java-7-oracle/bin/java
"# Comment 1"
"# Comment 2"
-Xms2048M
-Xmx2048M
-Xss6M
-XX:MaxPermSize=512M
-jar
/home/fernando/.sbt/launchers/0.13.0/sbt-launch.jar
clean
coveralls
doc
Error: Could not find or load main class # Comment 1
This situation will also happen when building on Travis CI, which uses this configuration:
# Tweaking for VM equipped with 3GB of RAM
# See also 'default_jvm_opts' defined in <%= File.join(node['sbt-extras']['setup_dir'], node['sbt-extras']['script_name']) %>
-Xms2048M
-Xmx2048M
-Xss6M
-XX:MaxPermSize=512M
For an example see this failed Travis CI build triggered by this script.
As a silly example, with SBT_OPTS='-scala-version 2.11.1'
Executing sbt -scala-version 2.10.4 -sbt-create 'show scalaVersion'
returns: [info] 2.11.1
Hi, I'm an Ubuntu user. Here's what I had to do to get the script working.
After cloning, I immediately tried to run it and bash choked on the line endings:
rose@marzipan:~/workspace/salat$ bash -x ~/workspace/sbt-extras/sbt
+ $'\r'
/home/rose/workspace/sbt-extras/sbt: line 5: $'\r': command not found
/home/rose/workspace/sbt-extras/sbt: line 8: syntax error near unexpected token `$'{\r''
'home/rose/workspace/sbt-extras/sbt: line 8: `get_script_path () {
So I used the flip
utility to recode the file to LF, one of the more satisfying sbt-related commands I have run this evening:
flip -u sbt
Then the script runs without choking, but unfortunately downloading the sbt jar fails because $sbt_version
has a CR appended to it, which borks sbtjar_release_url
:
++ build_props_sbt
++ [[ -f project/build.properties ]]
+++ grep '^sbt.version' project/build.properties
++ versionLine=$'sbt.version=0.10.1\r'
++ versionString=$'0.10.1\r'
++ echo $'0.10.1\r'
+ sbt_version=$'0.10.1\r'
So I tried some clever things with egrep
and finally lost my temper and did something inelegant instead.
build_props_sbt () {
if [[ -f project/build.properties ]]; then
#versionLine=$(grep ^sbt.version project/build.properties)
#versionString=${versionLine##sbt.version=}
versionString=$(sed '/^\#/d' project/build.properties | grep 'sbt.version' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
echo "$versionString"
fi
}
Success! If the dreaded trailing CR returns in some other context I will simply keep copying and pasting until everything is all patched up again.
Thanks for this awesome sbt runner. I hope this issue will be useful to others on Linux.
I want to verify that I can successfully call this script while provisioning a docker container. sbt-extras is set as an entrypoint in the docker container. I tried
docker run -i ${DOCKER_TAG} -help || { echo "ERROR: sbt -help does not return successfully" && exit 1; }
, but sbt -help
exits with code 1.
Shouldn't this exit with code 0?
If not, how can I verify that the script can be called?
The attempt to set all traceLevel values introduced in 35ad78c breaks sbt wrapper compatiblity w/ sbt 0.11.x
The following error occurs whenever sbt is run. The project is still loaded properly but this breaks any automated execution of sbt.
<set>:1: error: eof expected but integer literal found.
every traceLevel := 15
^
[error] Error parsing expression.
Looks like it is easy enough to fix and I'll try to throw a patch at it if I get time.
I realize this probably isn't at the top of @paulp's concerns, but I figured I'd record the issue in case someone wanted to tackle it (that someone might eventually be me).
The script currently references stty
, which isn't very Windows-friendly. I don't expect the whole thing to work out of the box on Windows, given it's a bash script, but it'd be helpful not to do things that are actually quite hard to get working nicely on Windows/msys/cygwin.
Debug option doesn't work on Mac:
$ xsbt -J-Xdebug -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8181
Detected sbt version 0.12.2
Starting xsbt: invoke with -help for other options
Listening for transport dt_socket at address: 8181
[info] Loading project definition from /Users/viktor/dev/projects/4bodyandmind/project
…
$ xsbt -jvm-debug 8181
Detected sbt version 0.12.2
Starting xsbt: invoke with -help for other options
[info] Loading project definition from /Users/viktor/dev/projects/4bodyandmind/project
…
First - working
java
-Dfile.encoding=UTF8
-XX:MaxPermSize=256m
-Xms512m
-Xmx1g
-XX:+CMSClassUnloadingEnabled
-XX:+UseConcMarkSweepGC
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8181
-Dsbt.global.base=/Users/viktor/.sbt/0.12.2
-jar
/Users/viktor/.sbt/launch/0.12.2/sbt-launch.jar
"set logLevel in Global := Level.Debug"
shell
Second - not working
java
-Dfile.encoding=UTF8
-XX:MaxPermSize=256m
-Xms512m
-Xmx1g
-XX:+CMSClassUnloadingEnabled
-XX:+UseConcMarkSweepGC
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8181"
-Dsbt.global.base=/Users/viktor/.sbt/0.12.2
-jar
/Users/viktor/.sbt/launch/0.12.2/sbt-launch.jar
"set logLevel in Global := Level.Debug"
shell
$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
OSX 10.8.3
IMHO, it's really weird to have long options with only one dash, i.e., -help. The usual convention is that single letter options have one dash (-h) and two dashes for the "long" version (--help).
Java makes this mistake, and drives most people crazy because of it. :/
On a new machine where I cloned my home directory, I had a symlink from .ivy2 to a location which didn't exist. On startup sbt fails immediately with "No such file or directory" but says absolutely nothing about ivy, or anything the least bit useful.
I'm trying to run a local instance of a Akka + Kafka process with a customized application.conf
:
sbt -Dconfig.file=`pwd`/application.conf run
But the process always uses the src/main/resources/application.conf
file.
When I run the process directly with the JVM on the command line, it works as expected.
Here's a collection of useful resources I've held on to for this:
These would also have to be wired into Travis.
In a project which has a .sbtopts
in the project root with a contents like this:
-Dmongodb.default.uri=mongodb://${DOCKER_HOST_IP}:27017/database
the Java property at runtime contains the literal ${DOCKER_HOST_IP}
string on it instead of the value of the environment variable.
When running sbt
installed from a deb package, the environment variables are replaced.
Maybe the project name could be used as a default. If it turns out to be too tricky to map it to a valid Scala identifier for all cases then "template" could be an alternative.
Right now the badges say passing on travis, failing on appveyor, which is what I'd expect given that apparently 0.13.14 doesn't work on windows.
But then why does the log sail through all the tests and declare "Build success" ?
Using JVM 8, I (not unexpectedly) get:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
during startup. Perhaps that setting should be conditional on JVM version, since it's irrelevant as of 8?
I recently found out, via @Nava2 on #125 (which is also relevant to this ticket), that Travis supports OS X:
https://docs.travis-ci.com/user/osx-ci-environment/
Given that sbt-extras intends to support both Linux and OS X we should setup it up to test both.
Assuming you have already resolved the sbt-assembly plugin (see #103) to replicate:
$ git clone https://github.com/DWiechert/scala-shell.git
$ cd scala-shell
$ sbt
Error message:
[info] Loading project definition from /home/tukushan/projects/scala-shell/project
[info] Updating {file:/home/tukushan/projects/scala-shell/project/}scala-shell-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
/home/tukushan/projects/scala-shell/build.sbt:7: error: not found: value EclipseKeys
EclipseKeys.withSource := true
^
[error] Type error in expression
It would be really good if we had a system that ensured our README snippets never bit rot.
However such a system shouldn't be fragile and require constant adult supervision and maintenance..
sbt -no-colors -batch compile &
Hitting "enter" causes the compile process to stop, it refuses to run again till put in "fg" mode. This is very inconvenient for running in scripts
The sbt-assembly plugin is not resolved.
To replicate:
$ git clone https://github.com/DWiechert/scala-shell.git
$ cd scala-shell
$ rm -rf ~/.ivy2/cache/scala_2.10/sbt_0.13/com.eed3si9n/
$ sbt
Error message:
...
[info] Resolving com.eed3si9n#sbt-assembly;0.13.0 ...
....
sbt.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.13.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
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)
Without the script (ie: java -jar ~/.sbt/launchers/0.13.6/sbt-launch.jar
) works fine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.