orrsella / play-maven-integration

A sample project integrating Play Framework and Maven

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any way to get this working with JAVA play app?

cthulu opened this issue · comments

Nice approach.
I'm trying this approach with Play 2.2.2 and JAVA Play! project (so, I need somehow to pass play.Project.playJavaSettings or mainLang=JAVA)
However, I can't get it working (I've tried putting it in the Build.scala). All my scala html templates fail to build as they use Java convention to get values
Any hints?

I haven't used Play with Java before, but I would imagine you can do something like:

object MyBuild extends Build {
  ...
  val root = play.Project("my-application-play", path = file("my-application-play"))
    .dependsOn(core)
    .settings(play.Project.playJavaSettings: _*)
    .settings(
      version := Pom.version(baseDirectory.value),
      libraryDependencies ++= Pom.dependencies(baseDirectory.value).filterNot(d => d.name == core.id))

  override def rootProject = Some(root)
}

Let me know if it still doesn't work, I can try creating an entire Java project.

Thanks, that seem to have done the trick ;-) I'm using alpha6 version of the maven play plugin.
Now I just have to figure out how to make my maven integration tests start the play app and run the tests ;-) In my case, the dependencies are the other way around - the pure maven module depends on the binaries produced by the play module

Hmm, that's a tricky question I guess. Play itself does have integration tests support, but it's usually done via that jar.

A play app's main is defined somewhere in play itself (I think it's a class named NettyServer). Since play is a "framework" and not a library, you're not supposed to invoke it in order to start the application, you're supposed to start the framework and have it invoke your code in the form of controllers (as far as I understand it). I'm not sure how that would work if you have an external pure-maven module that depends on play. I guess it's like having a jar depend on a war. Perhaps I don't have enough experience with these types of setups, but it seems weird to me.