Question

My project needs to use some third-party jars. I assume I drop these in the lib/ directory in my project, but where do I configure Play to add them to the classpath?

I'm developing in Eclipse, and I know I can add them to the Eclipse project's build path, but this won't necessarily make Play reference them when it runs.

Was it helpful?

Solution

Play automatically adds all jars in the application's lib directory to the classpath.

To quote:

A play application classpath is built as follows (in this order):

* The /conf directory for the application
* The $PLAY_PATH/framework/play.jar
* All jar files found in your application /lib directory
* All jar files found in the $PLAY_PATH/framework/lib directory

OTHER TIPS

Do not forget to do a

play ec

or

play eclipsify

when you add new jars in the lib folder. If you don't, Eclipse won't see them.

Play! runtime automatically finds third-parties jars from lib folder so don't worry for runtime.

Both of the answers so far are wrong because as soon as you sync it will delete them. It also starts to go around the package management feature of play.

Other methods (eg, Maven/etc) to include jars are listed here http://www.playframework.org/documentation/1.2.3/dependency

There is also a post in the Play mailing list here: http://groups.google.com/group/play-framework/browse_thread/thread/b54e4e25ae49161b

Follow the instructions given here:

How can I specify a local jar file as a dependency in Play! Framework 1.x

If using Eclipse, follow this with:

$ play ec

Be sure to restart your development server.

This answer really helped me. Slick way to add jars through inside conf/dependencies.yml https://stackoverflow.com/a/7185133/3439

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top