SaM
SaM

Reputation: 2520

How do I reference play framework third party modules without referencing an absolute path?

Here is my situation. I have a play app which uses the guice module. In order to work with the guice module:

The issue is that the content of that file is something like the following: /some-absolute-path/play-1.2.x/modules/guice-1.2.

That works fine when working locally for development. But when I want to move to a production server, with a different install of Play! (i.e. with a different absolute path to it) it will obviously fail.

So what's the best way to deal with this?

For now I've resorted to declaring the module in the application.conf file like this: module.guice=${play.path}/modules/guice-1.2. Unfortunately the ${play.path} magic doesn't seem to work on those generated files.

By the way I use version 1.2.3 of Play!

Upvotes: 5

Views: 1384

Answers (3)

Anton
Anton

Reputation: 6061

It's not answer to your question, but I have faced with same issue.

  • I don't want to call resync the dependencies on production.
  • I don't want to ask my team members, install special module.
  • I don't want to commit file containing absolute path with module location.

The only workaround that I find: do not install module in Play! application, just include jars which use this module manually. play-guice.jar should be included as @opensas suggested, aopalliance and com.google.inject as regular dependencies in dependencies.yml.

The funny thing, that resync dependencies is also deleting .svn files, so back-up its before calling this command.

Upvotes: 0

opensas
opensas

Reputation: 63525

you should try with ${application.path} in your dependencies.yml file, like in this example

require:
    - play -> crud
    - provided -> DateHelper 1.0 
repositories: 
    - provided: 
        type:       local 
        artifact:   "${application.path}/jar/[module]-[revision].jar" 
        contains: 
            - provided -> * 

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

Upvotes: 2

Pere Villega
Pere Villega

Reputation: 16439

When you run in production you will either resync the dependencies (via play deps command) with the local installation of Play or in some scenarios you can precompile everything and then there will be no issues with the paths.

That second scenario is the one with Heroku, for example.

Upvotes: 0

Related Questions