1

I previously asked a question here about how to use SBT with multiple sub project web applications. This worked excellent, now however I am trying to create a sub project that should NOT be a webapp, but which the other web app projects will depend on (common models etc etc). Is there a way to set up this sub project in along with the other web application sub projects OR should I just create a separate project alltogehter that creates a jar and have my webapps have it as a library dependency?

Currently I have the code for the non webapp project in as a subproject and the other sub projects depend on it, i.e.

 lazy val admin = Project("admin", file("admin")) dependsOn(common) settings(webappSettings :_*)
                                                  // ^^^^ defines the dependency
 ... other project definitions                     

 lazy val common = Project("common", file("common")) 

This works, but when I package the applications I get a common.war.

I should probably also mention that the common project does contain some web related code that depend on Lift, but I want it to be packaged as a jar and not a war... Oh, and the webapp wars seem to include the actual classes into the generated war from the common project.

So how should I:

  • Create a common project which contain web related code (will for instance need to run tests that uses jetty), but is compiled into a jar?
  • Include the common project in my web application projects?
  • Can/should the common project be included as a sub project along with my web applications?
Community
  • 1
  • 1
Emil L
  • 20,219
  • 3
  • 44
  • 65
  • 1
    Most examples I have seen have the settings as the last argument to the `Project` constructor and the `dependsOn` as the last thing, like [this example](https://github.com/harrah/xsbt/wiki/Full-Configuration-Example). Have you tried that? I don't know why what you have would give the behaviour you describe, particularly getting a war for the "common" project. I have a project [here](https://github.com/tekul/connect/blob/master/project/build.scala) which builds both a jar and a war which you might want to look at. – Shaun the Sheep Mar 08 '12 at 22:51

0 Answers0