auramo
auramo

Reputation: 13357

sbt native packager doesn't create scripts under target/universal/stage/bin

I'm trying to use JavaAppPackaging from sbt-native-packager. My understanding is, that when I run:

sbt stage

I should get a directory target/universal/stage/bin with some startup scripts. Now I only get lib which contains my jar and it's dependencies.

Here's the relevant parts of my build.sbt:

val scalatra = "org.scalatra" %% "scalatra" % "2.3.1"

enablePlugins(JavaAppPackaging)

lazy val root = (project in file(".")).
  settings(
    name := "myapp",
    version := "0.2",
    scalaVersion := "2.11.6",
    libraryDependencies += scalatra
  )

Also, my plugins.sbt has this:

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0")

I'm using sbt 0.13.8.

So why don't I get the startup scripts, what am I missing?

Upvotes: 5

Views: 2009

Answers (2)

Dale Wijnand
Dale Wijnand

Reputation: 6102

You need make sure sbt finds a main for the script.

This could mean either make sure you have a main: an object that extends App or one that defines a def main(args: Array[String]): Unit.

Otherwise try setting mainClass, like so:

 mainClass in Compile := Some("JettyLauncher")

Upvotes: 4

Muki
Muki

Reputation: 3641

Try setting the main class without any scopes: mainClass := Some ("full.path.to.MainApp")

Upvotes: 1

Related Questions