Add js library from npm as dependency to Play 2.0 app

I'm trying to add react-grid-layout to my play 2.0 web app. Firstly, I found web jar for this library and add it to build.sbt. So my sbt looks like as follows:

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "org.webjars" %% "webjars-play" % "2.4.0-1",
  "org.webjars" % "react" % "0.14.0",
  "org.webjars" % "marked" % "0.3.2",
  "org.webjars" % "jquery" % "2.1.4",
  "org.webjars.npm" % "react-grid-layout" % "0.9.1"
  )

In routes I have

GET     /webjars/*file              controllers.WebJarAssets.at(file)

All the libraries except react-grid-layout were successfully installed to target/web/web-modules directory. So, I guess the problem is with npm org.webjars.npm .

What should I do to install every js library correctly?

Answers


James explains it in the following github issue.

Deployment is manual for all libraries and their dependencies. But this is something that anyone can do with NPM & Bower WebJars. I think a good / easy first step with this is to present a list of missing transitive dependencies when a deployment finishes. That would make it easy for someone to walk through the tree to manually deploy everything.

He later adds:

It is possible that the WebJar you are trying to use is failing because of missing transitive dependencies. This usually happens when libraries are missing required metadata so they can't be imported into Maven Central. It is an unfortunate situation but there isn't much we can do to fix it. The alternative is to use Classic WebJars instead. Info on creating Classic WebJars: http://www.webjars.org/contributing

Check the full github issue linked above for the full conversation.


Need Your Help

Is Concurrent Mark Sweep (CMS) a stop the world event?

java garbage-collection jvm concurrent-mark-sweep

I see many unloading of classes and my entire system will hang during that period of time..

Adding a parameter to a method using attributes

c# aop custom-attributes

Admittedly, this one's a long shot. I'm working on an auditing piece where you open and close an audit record at the start and end of your action. I have it nicely rigged up so that in order to aud...