Is it possible to change play dist output file name apart from modifying appName on Build.scala?
I'm trying to automate the creation of two different zip files from the same project tree, e.g.: myapp-production-1.0-SNAPSHOT.zip and myapp-integration-1.0-SNAPSHOT.zip.
Thank you very much!
For Play Framework 2.4 changing the name of the output file worked like this in build.sbt:
packageName in Universal := "dist"
In Play Framework 2.2, you can add the following line to the build.sbt file:
name in Universal := "dist"
Your app will be packaged in target/universal/dist.zip
You can modify the output by changing the build.sbt file in your project directory.
name := "myname"
version := "1.0-SNAPSHOT"
Remember to recompile, might have to clean too.
Related
I want to attach sbt-native-packager to a root-aggregate of a project, but that root project has published name for Maven of "foobar". I want the artifact generated through universal:packageBin to consistently use "foo" instead.
How do I accomplish this?
I tried
name in Universal := "foo"
executableScriptName in Universal := "foo"
etc. None has an effect. I end up having bin/foobar and bin/foobar.bat.
executableScriptName is not properly scoped, so you have to do the following"
executableScriptName := "foo"
I'm having trouble concatenating and fingerprinting all the CoffeeScript files in Play application. Everything works fine for JavaScript files with build.sbt like this one
pipelineStages := Seq(concat, digest)
Concat.groups := Seq(
"javascripts/app.js" -> group(((sourceDirectory in Assets).value / "javascripts") * "*.js")
)
But when sourceDirectory is changed to resourcesManaged that supposedly contains compiled CoffeeScript files sbt-concat doesn't pick them up.
sbt-coffeescript, and all other official source task plugins, don't put their files in resourcesManaged in Assets, but instead their own sub-directory in target/web/<taskname>. They scope the resourcesManaged setting to their main task, in this case this means resourcesManaged in (Assets, coffeescript) and resourcesManaged in (TestAssets, coffeescript).
When you run sbt coffeescript you can see the files are output to target/web/coffeescript/main. You can verify this by running show web-assets:coffeescript::resourceManaged from the sbt console.
I am using:
scala 2.10.3
sbt 13.2
with plugin:
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.3")
I am using the universal:packgeBin to generate the universal zip file and publish to ivy repository.
I'd like to change the zip file name from project_id_scalaversion_buildVersion.zip to project_id_scalaversion_buildVersion_dist.zip. How would I do that?
This answer is based on version 1.0.3 that I have used, but it should apply to the latest version (1.1.5) as well.
You can name your package however you want. The only thing to do is to add the following setting to the configuration of your project:
Universal / packageName := s"${name.value}_${scalaVersion.value}_${version.value}_dist"
I think you cannot change the name of the generated artifact just for the universal:packageBin easily.
You can change the name of the generated artifact globally, by using artifactName.
artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
artifact.name + module.revision + "_dist." + artifact.extension
}
This will however also modify also the name of the generated jar file, and perhaps some other names of the generated artifacts.
If you wanted to change the name only of the file generated by the universal:packageBin you could rename the file after it was generated. Sbt gives you utilities which make this rather easy.
Universal / packageBin := {
val originalFileName = (Universal / packageBin).value
val (base, ext) = originalFileName.baseAndExt
val newFileName = file(originalFileName.getParent) / (base + "_dist." + ext)
IO.move(originalFileName, newFileName)
newFileName
}
Now invoking the Universal/packageBin should execute your new task, which will rename the file after it's created.
I am trying to build a Debian package using sbt-native-packager as described in this build.sbt.
I set appName using
val appName = "megamgateway"
in project/Build.scala.
All works well. It is just that the contents are stored in /usr/share/megamgateway.
I'd like to have the contents under /usr/share/megam/gateway.
The only way I could find is to use
linuxPackageMapping
as shown here.
Before following along, I'd like to know about other approaches.
You could try to add to your project settings
name := "gateway"
defaultLinuxInstallLocation := "/usr/share/megam/"
I was wondering if there is a difference in SBT between a project's name and id.
I noticed example build.sbt files with the following key:
name := "My Project"
And I noticed Build.scala files with:
Project(id = "My Project", base = file("."))
Is there a difference? Should the two be the same or is it irrelevant? What are they used for?
Thanks!
Project name should be used for the name of your project, the visible title for any documentation.
Id is used to refer to the project to modify settings or in terms of dependancy management, i.e to connect a subproject to a root project you can say subproject.dependsOn(rootProjectId)
In your build.sbt file you have a single project definition. You can also pass a name attribute to the settings of a Project in your build.scala. As you can have several sub projects in a build file, you have to provide an id for each of them, while the project name remains the same.