I want to use s3-sbt to upload the result of the package-zip-tarball task (from sbt-native-packager).
Currently, the important part of my build.sbt
looks like this:
mappings in upload := Seq(( ((package-zip-tarball in Universal).value) ,"trailhunger2-1.0.tgz"))
host in upload := "trailhunger.s3.amazonaws.com"
credentials += Credentials(Path.userHome / ".s3credentials")
On reload, sbt reports the following:
/Users/sarge/Documents/workspaces/TrailHunger/TrailHunger2/build.sbt:56: error: illegal start of simple expression
mappings in upload := Seq(( ((package-zip-tarball in Universal).value) ,"trailhunger2-1.0.tgz"))
^
/Users/sarge/Documents/workspaces/TrailHunger/TrailHunger2/build.sbt:56: error: ')' expected but eof found.
mappings in upload := Seq(( ((package-zip-tarball in Universal).value) ,"trailhunger2-1.0.tgz"))
^
[error] Error parsing expression. Ensure that there are no blank lines within a setting.
Update: After @SethTisue's answer my code now reads:
mappings in upload := Seq( ( (packageZipTarball in Universal).value ,"trailhunger2-1.0.tgz") )
Sadly, I get:
error: not found: value packageZipTarball
mappings in upload := Seq( ( (packageZipTarball in Universal).value ,"trailhunger2-1.0.tgz") )
^
[error] Type error in expression
My expectation is that (packageZipTarball in Universal)
does the same thing as universal:packageZipTarball
in the console. The .value
means that I can get the value of the task which is of type java.io.File. That then gets included in a tuple2 along with the string literal "trailhunger2-1.0.tgz". The surrounding Seq then makes a sequence with precisely one element.
I don't see why the value packageZipTarball cannot be found.
I have verified that show universal:packageZipTarball
returns the file name I expect.
Is s3-sbt too old to support the new sbt 0.13 syntax. Is nesting this in Seq incorrect?
Part 1
Are you using sbt 0.12 or 0.13?
In sbt 0.12 and earlier versions, keys are capitalized-like-this
in sbt's interactive mode, but are capitalizedLikeThis
in build definitions.
In sbt 0.13 capitalizedLikeThis
is accepted in both contexts. (capitalized-like-this
is still accepted in interactive mode, but only for backwards compatibility.)
Anyway, regardless of whether you're using 0.12 or 0.13, you need to change package-zip-tarball
to packageZipTarball
. The Scala parser thinks the former means package - zip - tarball
. And package
is a keyword, which is where the errors you're getting are coming from.
If you're on 0.13, you can forget the whole hyphens thing entirely as a now-irrelevant historical quirk.
Part 2
I've found that in order for packageZipTarball in Universal
to compile, you must add import com.typesafe.sbt.packager.Keys._
to the top of build.sbt.
The sbt-native-packager readme does have a couple uses of import
and of explicitly qualified names that begin with com.typesafe.sbt.packager
, so there was at least a little indication that something like this might be necessary, but maybe the doc ought to call it out more explicitly.