Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting Multiple projects w/ play! 2 (Scala)

the example on the wiki seems to work just fine, however my question is more about how to achieve this result and how to ultimately get the project (w/ the sub projects) into Eclipse using the Eclipsify util.

https://github.com/playframework/Play20/wiki/SBTSubProjects

Eclipsify-ing this project (after adjusting SBT plugin version) results in just the *-data project getting prepared for Eclipse. I tried switching projects from the play! prompt and eclipsify-ing the rest, but couldn't change the result.

Has anyone found a good walk through of setting up this type of project and getting it into Eclipse?

Are each sub projects created using 'play new'? Which files get removed? Which changed? How can we get eclipsify to work properly w/ multiple projects.

I'm using play 2.0.4 on Mac OS X. I'm building Scala projects.

Thanks.

==== update for ignore parent key ======

I've send that a few times. I was trying to get it to work w/ the example from the play! wiki. I have this:

import sbt._
import Keys._
import PlayProject._
import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys

/*
 * This contains a data project with models. It also contains a frontend web
 * app. Finally, there is a backend project. The backend project is just a copy
 * of the fronend project for demonstration purposes, but in real life may
 * contain heavy data batch processing jobs or similar. Both projects rely on
 * the same database and so must both depend on the data project which contains
 * the models. 
 */
object ApplicationBuild extends Build {

  val appName         = "example"
  val appVersion      = "1.0-SNAPSHOT"

  val dataDependencies = Seq(
  )

  val frontendDependencies = Seq(
  )

  val backendDependencies = Seq(
  )

  val dataProject = PlayProject(appName + "-data", appVersion, dataDependencies, path = file("data"), mainLang = JAVA)

  val frontend = PlayProject(appName + "-frontend", appVersion, frontendDependencies, path = file("frontend"), mainLang = JAVA).dependsOn(dataProject).aggregate(dataProject)

  val backend = PlayProject(appName + "-backend", appVersion, backendDependencies, path = file("backend"), mainLang = JAVA).dependsOn(dataProject).aggregate(dataProject)

  val main = PlayProject(appName) dependsOn(frontend,backend) aggregate (frontend,backend)

  override def settings = super.settings ++ Seq(EclipseKeys.skipParent in ThisBuild := false)
}

It won't compile. Do you have a clean example somewhere or can you see what I have incorrect? Thanks for the quick reply

like image 553
kyleroche Avatar asked Nov 13 '22 18:11

kyleroche


1 Answers

You can add the following command to build.sbt or project/Build.scala on the top level project to let sbt generate project files for the sub projects also.

EclipseKeys.skipParents in ThisBuild := false 

or you can run the following command directly from the play console:

eclipsify skip-parents=false

Then you can import the sub projects separately on Eclipse.

In your case, you forget to include the last letter 's' of 'skipParents' at the last line:

++ Seq(EclipseKeys.skipParent in ThisBuild := false) 

Change it to:

++ Seq(EclipseKeys.skipParents in ThisBuild := false)
like image 129
Faruk Sahin Avatar answered Nov 15 '22 13:11

Faruk Sahin