Git Product home page Git Product logo

sbt-extras's People

Contributors

channingwalton avatar colindean avatar d-ogxwx avatar dwijnand avatar fommil avatar gildegoma avatar jsuereth avatar julianmendez avatar leedm777 avatar lespea avatar lrytz avatar marconilanna avatar mcanlas avatar mdengler avatar micrypt avatar nequissimus avatar oldstevekenobi avatar paulp avatar pawelpanasewicz avatar purefn avatar retronym avatar rockymadden avatar sergiuszkierat avatar sethtisue avatar sideeffffect avatar szeiger avatar teamon avatar timothyklim avatar xerial avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sbt-extras's Issues

"warn" and "info" are not known tasks in sbt 0.11.2

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]     ^

Syntax error with JDK10

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.

sbt 0.13.0 won't work with JAVA_HOME logic

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

JAVA_OPTS and SBT_OPTS env variables not honored

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.)

`-batch` mode fails to bring java process to shell foreground (stty cannot be restored)

Since f525931 (save stty and trap exit, to ensure echo is reenabled if we are interrupted), sbt-extras script with -batchmode enabled fails to restore saved stty with following consequences:

  • the java process remains in background
  • the script exits too early and with "erroneous" return value of 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)

Add suspend=y support to jvm debug

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?

.sbtopts needs a newline at the end

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.

Consider adding a version, perhaps timestamp

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).

Question: IntelliJ and sbt-extras

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:

  1. Use the bundled version of SBT (used to be terrible, is still not awesome).
  2. Uninstall this (awesome) script, and use sbt from Community.

I don't like either of those choices - any recommendations for using sbt-extras with IntelliJ?

JAVA_HOME, -java-home and java binary incompatibilities

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?

.sbtignore seems to not work

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

Feature: Allow for multiple -jvm-debug

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

description of unit of mem option

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.

cygwin support

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!

Allow proxying All The Things

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!

Add -212 flag

As of right now, this should default to 2.12.0-M2.

sbt 1.x support

Hi,

I like sbt-extras. Are there any plans to support SBT 1.X?

Many thanks,
Paul

"sbt -210 -sbt-create console" breaks.

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

Support comments in jvm-opts file

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.

SBT_OPTS trumps command-line flags

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

Getting sbt-extras sbt script to work on Linux: a flipping odyssey

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.

How to check if the script can be successfully called

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?

set every traceLevel := 15 not supported in 0.11.x

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.

Support Windows pleasantly

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.

-jvm-debug not working on Mac

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

Use GNU getopt_long style options

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. :/

Be robust against missing .ivy2 directory

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.

-Dconfig.file ignored

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.

Environment variables in .sbtopts file are not replaced

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.

sbt script no longer working on OS X

Since commit 34c7370, readarray has been used to read the .jvmopts and .sbtopts files. Unfortunately, it seems this builtin bash command isn't available on OS X because it uses an older bash.

One solution is to use read in a while loop, as described on this SO answer.

Type error in expression

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

Add CI validation for the README snippets

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..

Cannot resolve sbt plugin

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.