Daniel
Daniel

Reputation: 6039

Play: IllegalArgumentException: lib/jquery/jquery.js could not be found

I'm using play (scala) and trying to add jquery. First added it as a dependency:

"org.webjars" %% "webjars-play" % "2.4.0-1",
"org.webjars" % "bootstrap" % "3.3.7",

Added webjars route:

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

And called the script:

<script src="@routes.WebJarAssets.at(WebJarAssets.locate("lib/jquery/jquery.js"))"></script>

When I run it I get:

[IllegalArgumentException: lib/jquery/jquery.js could not be found. Make sure you've added the corresponding WebJar and please check for typos.] 

I also tried this after cleaning.

Any ideas where I am going wrong? Here is the target folder btw:

enter image description here

Upvotes: 0

Views: 44

Answers (1)

James Ward
James Ward

Reputation: 29433

The WebJarAssets thing uses the files on the classpath, not the ones on the file system (in your case put there by sbt-web). To use WebJarAssets do this:

@routes.WebJarAssets.at(WebJarAssets.locate("jquery.js"))

Upvotes: 1

Related Questions