Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edit 2011:<br> Since then, <a href="https://stackoverflow.com/users/160378/retronym">retronym</a> (which posted an <a href="https://stackoverflow.com/questions/2887655/making-stand-alone-jar-with-simple-build-tool/2892363#2892363">answer in this page back in 2010</a>), made this <a href="https://github.com/retronym/sbt-onejar" rel="nofollow noreferrer">sbt-plugin "sbt-onejar"</a>, now in its <a href="https://github.com/sbt/sbt-onejar" rel="nofollow noreferrer"><strong>new address on GitHub</strong></a>, with docs updated for SBT 0.12.</p> <blockquote> <p><strong>Packages your project using <a href="http://one-jar.sourceforge.net/" rel="nofollow noreferrer">One-JAR™</a></strong></p> <p><code>onejar-sbt</code> is a simple-build-tool plugin for building a single executable JAR containing all your code and dependencies as nested JARs.<br> Currently One-JAR version 0.9.7 is used. This is included with the plugin, and need not be separately downloaded.</p> </blockquote> <hr> <p>Original answer:</p> <p>Directly, this is not possible without extending sbt (a <a href="http://code.google.com/p/simple-build-tool/wiki/CustomActions" rel="nofollow noreferrer">custom action</a> after the model of the <a href="http://code.google.com/p/simple-build-tool/wiki/RunningSbt" rel="nofollow noreferrer">"package" sbt action</a>).</p> <p><a href="http://wiki.github.com/alandipert/step/how-to-deploy-a-step-as-a-single-executable-jar" rel="nofollow noreferrer">GitHub mentions an assembly task</a>, custom made for jetty deployment. You could adapt it for your need though.</p> <p>The <a href="http://technically.us/git?p=sling.git&amp;a=blob&amp;f=project/build/AssemblyProject.scala&amp;h=2231d9c9c54b5cde7d54c52c360cc778a41e4e3e&amp;hb=HEAD" rel="nofollow noreferrer">code is pretty generic</a> (from <a href="http://groups.google.com/group/step-user/msg/7df47d814f12a45f" rel="nofollow noreferrer">this post</a>, and user Rio):</p> <pre><code> project / build / AssemblyProject.scala import sbt._ trait AssemblyProject extends BasicScalaProject { def assemblyExclude(base: PathFinder) = base / "META-INF" ** "*" def assemblyOutputPath = outputPath / assemblyJarName def assemblyJarName = artifactID + "-assembly-" + version + ".jar" def assemblyTemporaryPath = outputPath / "assembly-libs" def assemblyClasspath = runClasspath def assemblyExtraJars = mainDependencies.scalaJars def assemblyPaths(tempDir: Path, classpath: PathFinder, extraJars: PathFinder, exclude: PathFinder =&gt; PathFinder) = { val (libs, directories) = classpath.get.toList.partition(ClasspathUtilities.isArchive) for(jar &lt;- extraJars.get ++ libs) FileUtilities.unzip(jar, tempDir, log).left.foreach(error) val base = (Path.lazyPathFinder(tempDir :: directories) ##) (descendents(base, "*") --- exclude(base)).get } lazy val assembly = assemblyTask(assemblyTemporaryPath, assemblyClasspath, assemblyExtraJars, assemblyExclude) dependsOn(compile) def assemblyTask(tempDir: Path, classpath: PathFinder, extraJars: PathFinder, exclude: PathFinder =&gt; PathFinder) = packageTask(Path.lazyPathFinder(assemblyPaths(tempDir, classpath, extraJars, exclude)), assemblyOutputPath, packageOptions) } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload