paulp/sbt-extras — pull request #36 by gildegoma (2012-11-18 22:08:32+00:00)
Title: Add support of global (default) sbtopts and jvmopts files

## Context that lead to open this pull request

When installing `sbt-extras` on a small RAM system, the default JVM parameters are *always* not suitable (`-Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m`) and the sbt of course terminates with following error:

```
Error occurred during initialization of VM
Could not reserve enough space for object heap
```

[Typesafe packaged sbt-extras](https://github.com/sbt/sbt-launcher-package/blob/55e0dfdc65440cb02627ccbb290a9afba211a9dc/src/scripts/sbt#L42) solved that issue (like setting a default value to any other sbt-extra arguments) by optionally reading a default file (`/etc/sbt/sbtopts`), before reading local `.sbtopts`.

## Proposed Enhancement

I think such feature should also be part of original sbt-extras. Same concept should also apply to `jvmopts` files.

Attached code does following: Optionally read SBT and JVM arguments from config files in the following precedence order (first is highest):
1. **project** configuration locally stored in `./.sbtopts`
1. **all-user** configuration stored in `/etc/sbt/sbtopts`

## Further enhancement (to be discussed)

Why not provide a 3-level for storing opt files:
1. **project** configuration locally stored in `./.sbtopts`
1. **user** configuration stored in `$HOME/.sbtopts` (or why not `$HOME/.sbt/sbtopts` ?)
1. **all-user** configuration stored in `/etc/sbt/sbtopts`

(and of course, same logic for jvmopts)

## Credits:

code attached is partly based on [Typesafe fork](https://github.com/sbt/sbt-launcher-package/blob/55e0dfdc65440cb02627ccbb290a9afba211a9dc/src/scripts/sbt#L42)