Add Play Library to Maven Project

The Play Managing library dependencies docs explain how to configure SBT to use the Play library.

But, how can I add this library to a Maven project?

I'm trying to create a Java toJson method. I'd like to use Scala Play's JSON library to do the actual conversion to JSON work. I could just return a String in my Java method, but using the JsValue type would be stronger type safety.

Answers


The play json library is published to the typesafe maven repository as its own artifact. You can include it in your maven project like so:

<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>play-json_${play.scala.version}</artifactId>
    <version>${play.version}</version>
    <scope>compile</scope>
</dependency>

where the current value of play.scala.version as of this writing is 2.10 and play.version is 2.2.1.

If you don't use a private central repository like nexus or artifactory, add the typesafe repository to your pom by adding the following at the top level:

<repositories>
    <repository>
        <id>typesafe</id>
        <url>http://repo.typesafe.com/typesafe/releases/</url>
    </repository>
</repositories>

To see a full example of a maven pom that includes more libraries from Play, look at the sample pom included in the play-pure-maven-plugin's repository. You do not need to use the maven plugin (of which I am the author) in order to make use of these dependencies.

https://github.com/absurdhero/play-pure-maven-plugin/blob/master/sample_play_project_pom.xml


Need Your Help

Delphi 2010 - Text on TRichEdit to HTML

html delphi delphi-2010 rtf

I'm trying to convert a rich text on a TRichEdit component to HTML tags.I have a function for that, but it doesn't work because the text in the component is always sent on PlainText. The option Pla...

"partial views" best practices for 'container' divs?

html ajax partial-views

What is the 'best' way to handle the html markup for partial views? (which are also refreshed using AJAX) The biggest issue I run into is where to place the 'container' div...