Using external jars in Play framework
Asked Answered
G

3

7

Recently, I tried to use java-image-scaling library to resize the image files. So, I set java-image-scaling jar file through Eclipse as a way that usual Eclipse project sets its external jar file. In Eclipse, there is no error (I mean, there is no red underline.) to use java-image-scaling library. However, when I try to compile it through Play! console, the compiler said it cannot find java-image-scaling jar file. It is weird because I did exactly same with Joda Time library and there was no problem.

Am I missing something to use external jar(java library) in a project of Play framework?

enter image description here

Check this screenshot that shows I already added Joda datatime library and java-image-scaling library.

Gyno answered 13/1, 2013 at 8:42 Comment(0)
A
17

You have to add your dependency in the project/Build.scala file:

val appDependencies = Seq(
  "com.mortennobel" % "java-image-scaling" % "0.8.5"
)

Or you can drop your jar directly in a lib folder of your Play app.

Then, in the Play console, regenerate the Eclipse files using the command eclipsify or eclipse according to your Play version (2.1.x or 2.0.x).

For Joda time, it worked because this library is already existing in the Play dependencies.

Please refer to the Play documentation for further details.

Allaallah answered 13/1, 2013 at 9:3 Comment(0)
K
2

Here you find the procedure to add external jar in your project if you don't want to use dependencies: Add external Jar file to Play 2.0.4

Kindergartner answered 14/1, 2013 at 9:17 Comment(0)
R
0

in play 1.x, you can add include in conf/dependencies.yml

Readytowear answered 2/2, 2021 at 2:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.