Play Framework: Add a dependency that points to a directory of local jar files

≯℡__Kan透↙ 提交于 2019-12-11 08:51:55

问题


Is it possible to add a dependency to the dependencies.yml that points to a directory?

For example, using pseudo yml for the dependencies.yml, I want to do something like this:

require:
    - mycooldirectory

repositories:
    - mycooldirectory:
        type: local
        artifact: "${application.path}/jars/mycooldirectory/*.jar"
        contains: 
            - mycooldirectory -> *

In my make-believe-world, the above would include the mycooldirectory as a classpath folder and use any jars found in that directory.

I'm just making stuff up, but I hope that kind of explains what I want to do. I know you can put jars in the /lib directory but any jars unspecified by the dependencies.yml will get wiped when doing a play dependencies --sync. I also know you can specify single jars by doing this. However, I was just wondering whether you can do something similar but reference a whole directory full of jars?

Edit: I have a sort of workaround which works is by creating a Play module structure for mycooldirectory (i.e. have a lib directory under that directory) and put all the jars in that lib directory. And then in the dependencies.yml, do this:

require:
    - mycooldirectory -> mycooldirectory

repositories:
   - provided:    
       type:       local
       artifact:   "${application.path}/jars/[module]"
       contains:  
         - mycooldirectory

Though I was wondering whether there was a cleaner way of doing this without having to make a pretend module and just reference a new directory to have additional jars.


回答1:


This workaround is similar to yours, but it should work without a /lib directory. I haven't tested it, but it was on the mailing list and got positive feedback there.

require:
  - play
  - play -> googleclosure 1.2
  - provided -> mylib 1.0

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

Mailing list thread: https://groups.google.com/forum/#!topic/play-framework/tU5OJa5JFhs/discussion



来源:https://stackoverflow.com/questions/8600120/play-framework-add-a-dependency-that-points-to-a-directory-of-local-jar-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!