cómo usar project/Build.scala generar java playproject?

I use playframework2.2: try to build a play support project.

in my Build.scala, I want to add play.Project.playJavaSetting:

val main = play.Project(appName, appVersion, appDependencies)
.settings(play.Project.playJavaSettings)   //error here
    resolvers += "webjars" at "http://webjars.github.com/m2",
    resolvers += "typesafe" at "http://repo.typesafe.com/typesafe/release" 

el error es:

[error] F:\git\play-example-form\project\Build.scala:19: overloaded method value
settings with alternatives:
[error]   (ss: sbt.Def.Setting[_]*)sbt.Project <and>
[error]   => Seq[sbt.Def.Setting[_]]
[error]  cannot be applied to (Seq[sbt.Setting[_]])
[error]         .settings(play.Project.playJavaSettings)
[error]          ^

If I do not add playJavaSetting, it give me error about wrong collection apply, I mean:

    val main = play.Project(appName, appVersion, appDependencies)

y el error es:

[error]   required: play.api.data.Form<StudentFormData>,scala.collection.immutab
[error]   found: play.data.Form<StudentFormData>,java.util.Map<String,Boolean>,j

you can see the framework apply the scala.collection.immutable.List instead of play.util.List, If I really want to apply the java collections how to set the environment setting in Build.scala file?

preguntado el 28 de mayo de 14 a las 12:05

1 Respuestas

Deberías cambiar



.settings(play.Project.playJavaSettings: _*)

LA settings el método se declara como def settings(ss: Setting[_]*), which means it takes repeated parameters of type Setting[_]. play.Project.playJavaSettings es de tipo Seq[Setting[_]]. To convert one to another Scala has a special type annotation.

If you are interested in details check 4.6.2 Repeated Parameters of La especificación del lenguaje Scala

contestado el 28 de mayo de 14 a las 18:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.