You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-1Lines changed: 66 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# sbt-ammonite-classpath
2
2
3
-
**sbt-ammonite-classpath** is an sbt plug-in to export classpath of an sbt project to Ammonite Script, which can be then used in [Ammonite](https://ammonite.io/) or [Almond](http://almond.sh/).
3
+
**sbt-ammonite-classpath** is an sbt plug-in to export classpath of an sbt project to Ammonite Script, which can be then used in [Ammonite](https://ammonite.io/) or [Almond](http://almond.sh/). Also supports running Ammonite REPL directly with desired classpath.
This plugin also supports directly running Ammonite REPL from sbt. Similar to using above scopes you may launch the Ammonite REPL with desired classpath and compile scope as follows:
60
+
61
+
```bash
62
+
sbt "{scope}:{classpath}::launchAmmoniteRepl"
63
+
```
64
+
65
+
Where **`scope`** can be one of `compile`, `test` and `runtime`, while **`classpath`** can be one of `fullClasspath`, `dependencyClasspath`, `managedClasspath`, `unmanagedClasspath`.
If you would like to run Ammonite REPL with full classpath, you can simply use `launchAmmoniteRepl` task within `compile` (or any other) scope without having to specify classpath task scope:
74
+
75
+
```bash
76
+
sbt "compile:launchAmmoniteRepl"
77
+
# or simply (without scope, compile will be implied)
78
+
sbt launchAmmoniteRepl
79
+
```
80
+
81
+
`initialCommands` setting is also supported. If your `initialCommands` or `launchAmmoniteRepl / initialCommands` setting is not appropriate for a given scope, you can override it in one of this plugin's scopes. For example if you would like to only have `import ammonite.ops._` in your Ammonite REPL but not Scala REPL, you can do as follows:
Welcome to the Ammonite Repl 2.2.0-4-4bd225e (Scala 2.13.3 Java 1.8.0_252)
103
+
@ ls!pwd
104
+
res2: LsSeq =
105
+
".bloop"".gitignore"".vscode""build.sbt"'target
106
+
".git" ".metals" 'LICENCE 'project 'test
107
+
".github"".scalafmt.conf""README.md"'src
108
+
109
+
@
110
+
```
111
+
112
+
By default it will use the `"latest.release"` version of Ammonite, but if you would like to change it, you can override `ammoniteVersion` setting, e.g.:
113
+
114
+
``` scala
115
+
ammoniteVersion := "2.1.4"
116
+
Test / ammoniteVersion := "2.2.0"
117
+
```
118
+
54
119
## Related work
55
120
56
121
[sbt-ammonite](https://github.com/alexarchambault/sbt-ammonite) is an sbt 0.13 plug-in to launch Ammonite. It automatically passes the classpath instead of creating a `sc` file. However, it does not support Almond.
0 commit comments