I use sbt 0.13 and the sbt-release plugin in order to automatically increment version of a Play application, so I have file version.sbt
with the following line:
version in ThisBuild := "1.0-SNAPSHOT"
I also prepare mapping artifact name in order to prepare package with specific name per environment:
val main = play.Project(appName, dependencies = appDependencies).
settings(
...
artifactName := {(sv: ScalaVersion, module: ModuleID, artifact: Artifact) => {
val suffix = "-" + sys.props.getOrElse("environment","dev") + (if (artifact.classifier.isDefined) "-" + artifact.classifier.get else "")
artifact.name + "_" + sv.binary + "-" + version + suffix + "." + artifact.extension
}},
...
)
Evaluation of above code result in version value equal to 1.0 (probably it is some kind of default) because version.sbt define value as 1.0-SNAPSHOT
In lot cases I do something like this in order to use version from ThisBuild
:
SomeTask <<= (version in ThisBuild) map { ver => ...
some ver usage
...
}
But this specific solution does not work. Can someone provide an example how to use this specific value in artifactName
setting?
Another solution that will help me is to get string value from this variable. Thanks to it I will be able to do next thing:
val appVersion := ... // some operation on version in ThisBuild
val main = play.Project(appName, appVersion, dependencies = appDependencies)
I want to pass the value of the version
setting from version.sbt
file to artifactName
in order to provide the name for produced package.