Override “project” command in Build.scala

I have a quite heavy project with many modules aka sbt subprojects each of each has a big company name prefix. I've tried to find project command task key and override it, but didn't success. Is there any way to do this?

Answers


The best thing to do is to create a dedicated object, with its own Scala file, that would define a def Project.

That way you could have something like:

[your company].scala:

object <your company> {
  def Project(name: String = "", path: sbt.File, dependencies: Seq[ModuleID] = Seq.empty, isCompanyProject: Boolean = true) = {
    val settings = ...
    val projectName = if (companyProject) {
      ... // [your company / your project / whatever] + "-" + name
    } else name

    val project = sbt.Project(projectName, path, settings = ...)

    project
  }
}

in the same folder as your ApplicationBuild.scala file:

object ApplicationBuild extends Build {
  ...
  lazy val foo = <your company>.Project("foo", sbt.file("foo"), fooDependencies)
}

That way you could create a [your company] task that would call project with your company's prefix.


Need Your Help

Forms and ajax uploaded files

html ajax forms conventions

If I have form where user can upload files via Ajax (and upload is available only when JavaScript is turned on) and some other text fields etc. What if is user opens a new page for same form. Shoul...

How to place a variable inside of Directive HTML block and have it be accessed by Controller?

javascript angularjs angularjs-directive angularjs-scope

I have a directive that puts an HTML block onto the page. Inside that block I need there to be a variable that I can access and change, based on an ng-click function in my controller.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.