[
  {
    "path": ".gitignore",
    "content": "syntax: glob\n\nlib_managed\nproject/boot\nsrc_managed\ntarget\nclasses\n.idea/workspace.xml\n.idea/ant.xml\n.DS_Store\n*~\n.idea\n.idea_modules\n.lib\n.ivy\n.boot\n\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: scala\nsudo: false\njdk: oraclejdk8\nscript:\n- sbt test \"^ scripted\"\nbefore_cache:\n  - find $HOME/.sbt -name \"*.lock\" | xargs rm\n  - find $HOME/.ivy2 -name \"ivydata-*.properties\" | xargs rm\ncache:\n  directories:\n  - $HOME/.ivy2/cache\n  - $HOME/.sbt/launchers\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2010-2011 Coda Hale\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# sbt-onejar: Package your project using [One-JAR™](http://one-jar.sourceforge.net)*\n\nsbt-onejar is a [simple-build-tool](http://github.com/harrah/xsbt/wiki)\nplugin for building a single executable JAR containing all your code and dependencies\nas nested JARs.\n\nCurrently One-JAR version 0.9.7 is used. This is included with the plugin, and need not be separately downloaded.\n\n## Requirements\n\nRequires SBT 0.12.x, or 0.13.x\n\nUsers of SBT 0.7.x are directed to the [v0.2](https://github.com/retronym/sbt-onejar/tree/0.2).\n\nCurrently, you need to include the setting `exportJars := true` if you have a multi-project build. ([Example](https://github.com/retronym/sbt-onejar/blob/master/src/sbt-test/one-jar/multi/project/build.scala#L7))\n\n## Obtaining\n\nDepend on the plugin by editing\n`project/plugins.sbt`:\n\n```\naddSbtPlugin(\"org.scala-sbt.plugins\" % \"sbt-onejar\" % \"0.8\")\n```\n\n## Introduce Settings\n\nInclude the settings from `com.github.retronym.SbtOneJar.oneJarSettings`.\n\nYou can configure `mainClass in oneJar := Some(\"com.acme.Woozler\")`. It defaults to `mainClass in run in Compile`.\n\nExamples\n\n* [Light Configuration](https://github.com/retronym/sbt-onejar/blob/master/src/sbt-test/one-jar/basic/build.sbt#L1)\n* [Full Configuration](https://github.com/retronym/sbt-onejar/blob/master/src/sbt-test/one-jar/multi/project/build.scala#L15)\n\n## Usage\n\nrun `one-jar` task to generate, erm, one JAR. Run it with `java -jar <jarname>`.\n\n## What's in the JAR?\n\nAs an example of the structure, here is the contents of `scalaz-example_2.8.1-5.1-SNAPSHOT-onejar.jar`, a package built\nfrom the Scalaz examples module.\n\n    .\n    |-- META-INF\n    |           `-- MANIFEST.MF\n    |-- OneJar.class\n    |-- boot-manifest.mf\n    |-- com\n    |   `-- simontuffs\n    |       `-- onejar\n    |           |-- Boot$1.class\n    |           |-- Boot$2.class\n    |           |-- Boot$3.class\n    |           |-- Boot.class\n    |           |-- Handler$1.class\n    |           |-- Handler.class\n    |           |-- IProperties.class\n    |           |-- JarClassLoader$1.class\n    |           |-- JarClassLoader$2.class\n    |           |-- JarClassLoader$ByteCode.class\n    |           |-- JarClassLoader$FileURLFactory$1.class\n    |           |-- JarClassLoader$FileURLFactory.class\n    |           |-- JarClassLoader$IURLFactory.class\n    |           |-- JarClassLoader$OneJarURLFactory.class\n    |           |-- JarClassLoader.class\n    |           |-- OneJarFile$1.class\n    |           |-- OneJarFile$2.class\n    |           |-- OneJarFile.class\n    |           `-- OneJarURLConnection.class\n    |-- doc\n    |   `-- one-jar-license.txt\n    |-- lib\n    |   |-- scala-library.jar\n    |   |-- scalaz-core_2.8.1-5.1-SNAPSHOT.jar\n    |   |-- scalaz-example_2.8.1-5.1-SNAPSHOT.jar\n    |   |-- scalaz-geo_2.8.1-5.1-SNAPSHOT.jar\n    |   |-- scalaz-http_2.8.1-5.1-SNAPSHOT.jar\n    |   `-- servlet-api-2.5.jar\n    |-- main\n        `-- scalaz-example_2.8.1-5.1-SNAPSHOT.jar\n\n## How does it compare to XXX?\n\nThere are other ways to package your application. I based this plugin on Coda Hale's\n[sbt-assembly](https://github.com/codahale/assembly-sbt) which builds an über-JAR, directly containing\nall classes and resources merged together. This approach must be used carefully\nwhen there are resources with the same name across multiple JARs.\n\nKris Nuttycombe's [sbt-proguard-plugin](http:github.com/nuttycom/sbt-proguard-plugin) also creates an über-JAR, with the\npossibility to obfuscate and shrink. This is popular for targeting Android. Proguard is a powerful tool, and it\ntakes some effort to configure it correctly.\n\nOne-JAR employs some classloader magic to sidestep the über-JAR limitations. It does support\nclasspath scanning, as used in Spring and Hibernate, although there seems to be a performance penalty for this. But\nif your application, or its libraries, also relies on classloader trickery, you might run into some problems. Caveat Emptor.\n\nLooking for something else? One of these might suit: WebStart, Exe4J, jsmooth, izpack.\n\nhttp://stackoverflow.com/questions/1967549/java-packaging-tools-alternatives-for-jsmooth-launch4j-onejar\n\n## Bugs\n\nPlease report bugs and feature requests to the GitHub issue tracker. Bugs with small sample project will get the most\nattention. Forks and Pull Requests are also welcome.\n\nProblems with One-JAR itself should be reported on it's [Issue Tracker](http://sourceforge.net/tracker/?group_id=111153)\n\n## License\n\nCopyright (c) 2011-2011 Jason Zaugg\n\nPublished under The MIT License, see LICENSE\n\nThe One-JAR License is reproduced below. This plugin is not endorsed in anyway by One-JAR.\n\n>One-JAR (http://one-jar.sourceforge.net).  Copyright (c) 2004,\n>P. Simon Tuffs (simon@simontuffs.com).  \tAll rights reserved.\n>\n>Redistribution and use in source and binary forms, with or without\n>modification, are permitted provided that the following conditions are met:\n>\n>Redistributions of source code must retain the above copyright notice, this\n>list of conditions and the following disclaimer.\n>\n>Redistributions in binary form must reproduce the above copyright notice,\n>this list of conditions and the following disclaimer in the documentation\n>and/or other materials provided with the distribution.\n>\n>Neither the name of P. Simon Tuffs, nor the names of any contributors,\n>nor the name One-JAR may be used to endorse or promote products derived\n>from this software without specific prior written permission.\n>\n>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n>AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n>IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n>ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n>LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n>CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n>SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n>INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n>CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n>ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n>POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "build.sbt",
    "content": "name := \"sbt-onejar\"\n\ncrossSbtVersions := Seq(\"0.13.17\", \"1.1.6\")\n\nScriptedPlugin.scriptedSettings\n\nscriptedLaunchOpts += (\"-Dplugin.version=\" + version.value)\n\norganization := \"org.scala-sbt.plugins\"\n\nversion := \"0.9-SNAPSHOT\"\n\nsbtPlugin := true\n\nscalacOptions in Compile ++= Seq(\"-deprecation\")\n\npublishTo := Some(Resolver.url(\"sbt-plugin-releases\", new URL(\"http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/\"))(Resolver.ivyStylePatterns))\n\npublishMavenStyle := false\n"
  },
  {
    "path": "notes/0.1.markdown",
    "content": "* First release of sbt-onejar, for SBT 0.7.7"
  },
  {
    "path": "notes/0.2.markdown",
    "content": "* Exclude unneeded contents from JAR"
  },
  {
    "path": "notes/0.3.markdown",
    "content": "* Move to SBT 0.10"
  },
  {
    "path": "notes/0.4.markdown",
    "content": "* Move to SBT 0.11"
  },
  {
    "path": "notes/0.5.markdown",
    "content": "* Automatically configure the attribute `One-Jar-Main-Class` in the Manifest."
  },
  {
    "path": "notes/0.6.markdown",
    "content": "* Cross build against SBT 0.11.0 and SBT 0.11.1"
  },
  {
    "path": "notes/about.markdown",
    "content": "[sbt-onejar][1] is a plug-in for Simple Build Tool that packages your application and its\ndependencies in a single, executable JAR file using [One-JAR&trade;](http://one-jar.sourceforge.net)\n\nThe executable JAR contains your third party libraries as nested JARs, much like a WAR file.\n\nAlternatives ways to package your application:\n\n* As an &uuml;ber-JAR with [sbt-assembly][2]\n* Obfuscated and trimmed of fat with [xsbt-proguard-plugin][3]\n* With a graphical installer via [sbt-izpack][4]\n\n[1]: https://github.com/retronym/sbt-onejar\n[2]: https://github.com/eed3si9n/sbt-assembly\n[3]: https://github.com/siasia/xsbt-proguard-plugin\n[4]: http://software.clapper.org/sbt-izpack/"
  },
  {
    "path": "project/build.properties",
    "content": "sbt.version=0.13.17\n"
  },
  {
    "path": "project/plugins.sbt",
    "content": "libraryDependencies += \"org.scala-sbt\" % \"scripted-plugin\" % sbtVersion.value\n"
  },
  {
    "path": "src/main/resources/one-jar-license.txt",
    "content": "/*\n * One-JAR (http://one-jar.sourceforge.net).  Copyright (c) 2004,\n * P. Simon Tuffs (simon@simontuffs.com).  \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * Neither the name of P. Simon Tuffs, nor the names of any contributors,\n * nor the name One-JAR may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n"
  },
  {
    "path": "src/main/scala/com/github/retronym/SbtOneJar.scala",
    "content": "package com.github.retronym\n\nimport sbt._\nimport Keys._\nimport java.util.jar.Attributes.Name._\nimport sbt.Defaults._\nimport sbt.Package.ManifestAttributes\n\n// TODO Either fail if exportJars == false, or access the other project artifacts via BuildStructure\nobject SbtOneJar extends AutoPlugin {\n\n  object autoImport {\n    val oneJar = TaskKey[File](\"one-jar\", \"Create a single executable JAR using One-JAR™\")\n    val oneJarRedist = TaskKey[Set[File]](\"one-jar-redist\", \"The redistributable One-JAR™ launcher, unzipped.\")\n\n    @deprecated(\"will be removed. add `enablePlugins(SbtOneJar) in build.sbt`\", \"0.9\")\n    def oneJarSettings: Seq[Def.Setting[_]] = SbtOneJar.projectSettings\n  }\n\n  import autoImport._\n\n  override def requires = plugins.JvmPlugin\n\n  override val projectSettings: Seq[Def.Setting[_]] = inTask(oneJar)(Seq(\n    artifactPath := artifactPathSetting(artifact).value\n  )) ++ Seq(\n    publishArtifact in oneJar := publishMavenStyle.value,\n    artifact in oneJar := moduleName(Artifact(_, \"one-jar\")).value,\n    packageOptions in oneJar := Seq(ManifestAttributes((MAIN_CLASS, \"com.simontuffs.onejar.Boot\"))),\n    mainClass in oneJar := (mainClass in run in Compile).value,\n    packageOptions in oneJar ++= (mainClass in oneJar).map {\n      case Some(mainClass) => Seq(ManifestAttributes((\"One-Jar-Main-Class\", mainClass)))\n      case _ => Seq()\n    }.value,\n    baseDirectory in oneJarRedist := (target.value / \"one-jar-redist\"),\n    oneJarRedist := {\n      val base = (baseDirectory in oneJarRedist).value\n      val oneJarResourceName = \"one-jar-boot-0.97.jar\"\n      val s = getClass.getClassLoader.getResourceAsStream(oneJarResourceName)\n      if (s == null) sys.error(\"could not load: \" + oneJarResourceName)\n      def include(path: String) = path match {\n        case \"META-INF/MANIFEST.MF\" => false\n        case x => !x.startsWith(\"src/\")\n      }\n      IO.unzipStream(s, base, include _)\n    },\n    mappings in oneJar := {\n      val artifact = (packageBin in Compile).value\n      val classpath = (dependencyClasspath in Runtime).value\n      val oneJarRedistBase = (baseDirectory in oneJarRedist).value\n      val thisArtifactMapping = (artifact, (file(\"main\") / artifact.name).getPath)\n      val deps: Seq[(File, String)] = {\n        val allDeps = Attributed.data(classpath).map(f => (f, (file(\"lib\") / f.name).getPath))\n        allDeps.filterNot(_._1 == artifact)\n      }\n\n      val redist = oneJarRedist.value.toSeq pair Path.relativeTo(oneJarRedistBase)\n      Seq(thisArtifactMapping) ++ deps ++ redist\n    },\n    oneJar := {\n      val output = (artifactPath in oneJar).value\n      val packageConf = new Package.Configuration((mappings in oneJar).value, output, (packageOptions in oneJar).value)\n      Package(packageConf, Compat.cacheStoreFactory(streams.value.cacheDirectory), streams.value.log)\n      output\n    }\n  )\n}\n"
  },
  {
    "path": "src/main/scala-sbt-0.13/com/github/retronym/Compat.scala",
    "content": "package com.github.retronym\n\nimport java.io.File\n\nprivate[retronym] object Compat {\n  def cacheStoreFactory(base: File) = base\n}\n"
  },
  {
    "path": "src/main/scala-sbt-1.0/com/github/retronym/Compat.scala",
    "content": "package com.github.retronym\n\nimport java.io.File\n\nprivate[retronym] object Compat {\n  def cacheStoreFactory(base: File) = sbt.util.CacheStoreFactory(base)\n}\n"
  },
  {
    "path": "src/sbt-test/one-jar/basic/build.sbt",
    "content": "enablePlugins(SbtOneJar)\n\nlibraryDependencies += \"commons-lang\" % \"commons-lang\" % \"2.6\"\n"
  },
  {
    "path": "src/sbt-test/one-jar/basic/project/plugins.sbt",
    "content": "addSbtPlugin(\"org.scala-sbt.plugins\" %% \"sbt-onejar\" % System.getProperty(\"plugin.version\"))\n"
  },
  {
    "path": "src/sbt-test/one-jar/basic/src/main/scala/basic/basic.scala",
    "content": "package basic\n\nobject Basic {\n  def main(args: Array[String]) {\n    import org.apache.commons.lang.ObjectUtils\n    \n    println(\"hello world\")\n  }\n}"
  },
  {
    "path": "src/sbt-test/one-jar/basic/test",
    "content": "> show oneJar::mainClass\n> show oneJar\n> show oneJarRedist\n"
  },
  {
    "path": "src/sbt-test/one-jar/multi/alpha/src/main/scala/alpha/alpha.scala",
    "content": "package alpha\n\nobject Alpha"
  },
  {
    "path": "src/sbt-test/one-jar/multi/beta/src/main/scala/beta/beta.scala",
    "content": "package beta\n\nobject Beta {\n  def main(args: Array[String]) {\n    println(alpha.Alpha)\n  }\n}"
  },
  {
    "path": "src/sbt-test/one-jar/multi/build.sbt",
    "content": "def standardSettings = Seq(\n  exportJars := true\n)\n\nlazy val alpha = Project(\"alpha\", file(\"alpha\"))\n  .settings(standardSettings)\n\nlazy val beta = Project(\"beta\", file(\"beta\"))\n  .dependsOn(alpha)\n  .enablePlugins(SbtOneJar)\n  .settings(\n    standardSettings\n  )\n"
  },
  {
    "path": "src/sbt-test/one-jar/multi/project/plugins.sbt",
    "content": "addSbtPlugin(\"org.scala-sbt.plugins\" %% \"sbt-onejar\" % System.getProperty(\"plugin.version\"))\n"
  },
  {
    "path": "src/sbt-test/one-jar/multi/test",
    "content": "> show oneJar\n"
  }
]