Skip to content

Instantly share code, notes, and snippets.

@al3x
Created November 24, 2009 22:35
Show Gist options
  • Select an option

  • Save al3x/242304 to your computer and use it in GitHub Desktop.

Select an option

Save al3x/242304 to your computer and use it in GitHub Desktop.
override def mainClass = Some("com.yourcompany.yourproject.Main")
/**
* In the classpath:
* - all dependencies (via Ivy/Maven and in lib)
* - package classes
* On the filesystem:
* - scripts
* - config
*/
def distPath = (
// NOTE the double hashes (##) hoist the files in the preceeding directory
// to the top level - putting them in the "base directory" in sbt's terminology
((outputPath ##) / defaultJarName) +++
mainResources +++
mainDependencies.scalaJars +++
descendents(info.projectPath, "*.sh") +++
descendents(info.projectPath, "*.rb") +++
descendents(info.projectPath, "*.conf") +++
descendents(info.projectPath / "lib" ##, "*.jar") +++
descendents(managedDependencyRootPath / "compile" ##, "*.jar")
)
// creates a sane classpath including all JARs and populates the manifest with it
override def manifestClassPath = Some(
distPath.getFiles
.filter(_.getName.endsWith(".jar"))
.map(_.getName).mkString(" ")
)
def distName = "yourproject-%s.zip".format(version)
lazy val zip = zipTask(distPath, "dist", distName) dependsOn (`package`) describedAs("Zips up the project.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment