Skip to content

Commit 3e69f31

Browse files
committed
package as fat JAR (with spray-json bundled). fixes #18
1 parent 5c7e573 commit 3e69f31

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ incremental recompile times.
1515

1616
## Building the plugin from source
1717

18-
`sbt package` will create `target/scala-2.11/scala-sculpt_2.11-0.1.0.jar`.
18+
`sbt assembly` will create `target/scala-2.11/scala-sculpt_2.11-0.1.0.jar`.
19+
(The JAR is a fat JAR that bundles its dependency on spray-json.)
1920

2021
## Using the plugin
2122

2223
You can use the compiled plugin with the Scala 2.11 compiler as follows.
2324

2425
Supposing you have `scala-sculpt_2.11-0.1.0.jar` in your current working directory,
25-
along with `spray-json_2.11-1.3.2.jar` (which you can download
26-
[here](http://repo1.maven.org/maven2/io/spray/spray-json_2.11/1.3.2/spray-json_2.11-1.3.2.jar).
2726

2827
Then you can do e.g.:
2928

30-
scalac -Xplugin:scala-sculpt_2.11-0.1.0.jar:spray-json_2.11-1.3.2.jar \
29+
scalac -Xplugin:scala-sculpt_2.11-0.1.0.jar \
3130
-Xplugin-require:sculpt \
3231
-P:sculpt:out=dep.json \
3332
Dep.scala
@@ -124,7 +123,7 @@ manipulation, e.g. in the REPL.
124123

125124
Now in a Scala 2.11 REPL with the same JARs on the classpath:
126125

127-
scala -classpath scala-sculpt_2.11-0.1.0.jar:spray-json_2.11-1.3.2.jar
126+
scala -classpath scala-sculpt_2.11-0.1.0.jar
128127

129128
If we load `dep.json` as follows, we'll see the following graph:
130129

build.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ scalacOptions ++= Seq(
2424
"-Xfatal-warnings"
2525
)
2626

27+
// generate same JAR name as `package` would:
28+
// - don't append "-assembly"; see issue #18
29+
// - and do include the "_2.11", don't know why assembly removes that by default
30+
assemblyJarName in assembly :=
31+
s"${name.value}_${scalaBinaryVersion.value}-${version.value}.jar"
32+
2733
mappings in (Compile, packageBin) ++= Seq(
2834
(baseDirectory.value / "README.md") -> "README.md",
2935
(baseDirectory.value / "LICENSE.md") -> "LICENSE.md")

project/assembly.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.1")

0 commit comments

Comments
 (0)