1

I am evaluating Play 2.x for Java for my org, and would like to use a pom.xml (or if it comes to that, an ivy.xml) file in conjunction with my Build.scala, as this makes for far easier IDE integration.

I looked both at https://github.com/playframework/Play20/wiki/SBTDependencies and at https://github.com/harrah/xsbt/wiki/Library-Management, and I unfortunately couldn't figure out where I should add the externalPom() call.

So the structure of my project is as follows:

projectname 
-pom.xml
-project
    - Build.scala

and this is my Build.scala file:

object ApplicationBuild extends Build {

    val appName         = "Siddhu Warrier"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      // Add your project dependencies here,
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      // Add your own project settings here
    )

}

How do I get it to use my pom.xml?

Thanks in advance!

Siddhu
  • 888
  • 3
  • 9
  • 28
  • See Cathal's answer in http://stackoverflow.com/questions/9070336/how-to-have-eclipse-recognize-dependencies-from-sbt for a way to go the other direction (tell sbt to generate an ivy.xml file, then use IvyDE in Eclipse) – James Moore Aug 17 '13 at 23:26

2 Answers2

3

this sounds like a pure sbt related question (so if this does not work, I would recommend to ask it here https://groups.google.com/forum/?fromgroups#!forum/simple-build-tool), anyway, try to add externalPom() to the existing settings block or the main project's settings ie

val myExternalPom = super.settings ++ externalPom(baseDirectory(_ / "custom-name.xml"))
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA, settings = myexternalPom).settings(
  // Add your own project settings here
)

or

 val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      externalPom() :_*
    )

that usually works for most settings

poko
  • 258
  • 2
  • 8
  • Nope, that didn't work for me (from a virgin 'play new' project). Ah well... my basic problem is my poor understanding of SBT and my lack of knowledge of Scala i guess. – Siddhu Jul 10 '12 at 21:27
1

Have you looked at the play2-maven-plugin? It seems as though it should do what you are asking, since it appears it will build your project using your pom.xml. From my understanding it simply wraps Play commands for use with Maven.

http://cescoffier.github.com/maven-play2-plugin/maven/release/

Just note that I have not used this plug-in myself but was originally interested in it when I started a Play2 project.

Jeff LaJoie
  • 1,725
  • 2
  • 17
  • 27
  • Thanks, that's very interesting; I'll take a look. But I'd still like to figure out how to do it with SBT out of sheer bloody-mindedness – Siddhu Jul 10 '12 at 19:47