A simple sbt plugin for file upload to any destinations.
!!! Currently under development. !!!
This plugin supports sbt version 1.x and 0.13.x.
- Add to your
project/plugins.sbt.resolvers += Resolver.url( "crossroad0201 Plugin Repository", url("https://dl.bintray.com/crossroad0201/sbt-plugins/") )(Resolver.ivyStylePatterns) addSbtPlugin("com.github.crossroad0201" % "sbt-fileupload" % VERSION)
-
import
fileupload._. -
Enable
FileUploadPluginviaenablePlugins(). -
Define upload files and destination via
uploadSetskey.- if
keepDirStructureoption isfalse, upload file(s) to just under the destination.(Defaulttrue)
- if
import fileupload._
lazy val root = (project in file("."))
.enablePlugins(FileUploadPlugin)
.settings(
uploadSets := Seq(
// Specify file path.
UploadSet(
dest = AmazonS3("YOUR-S3-BUCKET", "files"),
fileSet = Seq(
file("foo/bar.txt")
)
),
// Specify Apache-Ant style file pattern.
UploadSet(
dest = AmazonS3("YOUR-S3-BUCKET", "modules"),
keepDirStructure = false,
fileSet = AntStyle(file("target"))
.includes(
"**/*.jar"
)
)
)
)Run fileUpload task.
sbt fileUploadUse fileupload.AmazonS3(bucketName, prefix).
AWS credential is working with Default Credential Provider Chain.
// Bucket only.
dest = AmazonS3("BUCKET_NAME")
// Bucket with prefix.
dest = AmazonS3("BUCKET_NAME", "PREFIX")Specify upload file(s).
// a file.
fileSet = file("foo")
// some files.
fileSet = Seq(
file("foo"),
file("bar")
)Upload matched file(s) under a specific base directory.
About the pattern for file name, see here.
fileSet = AntStyle(file("BASE_DIR"))
.includes(
"*.jar",
"**/*.jar"
)
.excludes(
"temp/**/*"
)Run sbt test for regular unit tests.
Run sbt "^ publishLocal" && (cd src/sbt-test/sbt-fileupload/simple && sbt -Dplugin.version=0.1-SNAPSHOT fileUpload) for plugin usage tests.
- Create account on Bintray.
- Change version in
build.sbt. - Run sbt.
- Run
bintrayChangeCredentialstask. (Prompt Bintray username and API key) - Run
^ publishtask. (Do not forget^for cross sbt build)
See here for more information.