Sbt-native-packager cannot import NativePackagerKeys._ in Build.scala
The title says it all. I'm sure it's something small, but I've been doing it for several hours and can't lick it.
- SBT 13.7
- sbt-native-packager 1.0.0-M1
- Using AutoPlugins
- scala 2.10.4
- using Build.scala
- using sbt script for standardization
My folder project
looks like this:
project/ project/* target/* Build.scala plugins.sbt
plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-M1")
Build.scala
import sbt._
import Keys._
object BuildSettings {
val buildName = "ASDF"
val buildOrganization = "BLAH"
val buildVersion = "0.1-SNAPSHOT"
val buildScalaVersion = "2.10.4"
val buildSettings = Defaults.defaultSettings ++ Seq(
organization := buildOrganization,
version := buildVersion,
scalaVersion := buildScalaVersion,
shellPrompt := ShellPrompt.buildShellPrompt,
scalacOptions ++= Seq("-encoding", "utf8", "-unchecked", "-deprecation", "-feature")
)
}
object ShellPrompt {
object devnull extends ProcessLogger {
def info (s: => String) {}
def error (s: => String) { }
def buffer[T] (f: => T): T = f
}
def currBranch = (
("git status -sb" lines_! devnull headOption)
getOrElse "-" stripPrefix "## "
)
val buildShellPrompt = {
(state: State) => {
val currProject = Project.extract (state).currentProject.id
"%s:%s:%s> ".format (
currProject, currBranch, BuildSettings.buildVersion
)
}
}
}
object Packaging {
import com.typesafe.sbt.SbtNativePackager._
import NativePackagerKeys._
val packagingSettings = Seq(
name := BuildSettings.buildName,
NativePackagerKeys.packageName := "asdf"
) ++ Seq(packageArchetype.java_application:_*) ++ buildSettings
}
object Resolvers {
val twttrRepo = "Twitter Repo" at "http://maven.twtter.com"
val sonaTypeRepo = "SonaType Repo" at "https://oss.sonatype.org"
}
object Dependencies {
val finatra = "com.twitter" %% "finatra" % "1.5.4"
val finagleHttp = "com.twitter" %% "finagle-http" % "6.2.0"
val scalaTest = "org.scalatest" % "scalatest_2.10" % "2.0" % "test"
val argonaut = "io.argonaut" %% "argonaut" % "6.0.4"
}
object ASDF extends Build {
import Resolvers._
import Dependencies._
import BuildSettings._
val commonDeps = Seq (
finatra,
finagleHttp,
argonaut,
scalaTest
)
lazy val root: Project = Project(
buildName,
file("."),
settings = buildSettings ++ Seq(libraryDependencies ++= commonDeps)
++ Packaging.packagingSettings
)
}
What spits out when trying to compile
[error] /Users/penland365/Development/sabrelabs/projects/CortanaTripCase/server/project/Build.scala:45: not found: value NativePackagerKeys
[error] import NativePackagerKeys._
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed`
I've tried moving these import instructions around but don't see anything else yet. Any ideas? Thank.
+3
source to share
1 answer
If you are using an automatic plugin, it is recommended to use multi-project build.sbt .
To answer the question about keys, you should probably try
import com.typesafe.sbt.SbtNativePackager.autoImport._
+4
source to share