views:

336

answers:

2

I have a jruby rails app that has some jar dependencies in rails lib/java. I prefer this to just putting them straight in lib as it separates my java libs from ruby libs. Works locally using jruby. Problem is, on deploy, tomcat is looking for a bunch of these jars (such as jruby) in WEB-INF/lib, not WEB-INF/lib/java.

I think i need to put some config in the web.xml that tells tomcat to also look in lib/java, but i can't find ANY docs on the matter.

I don't want to modify tomcat's system wide classpath, I just want to tell its class loader to check a directory other than WEB-INF/lib for this particular app only

Can anyone enlighten me on how to do this?

A: 

you can't change this directory, j2ee spec says that all libs go in WEB-INF/lib. That is where they are supposed to go.

fuzzy lollipop
that's a drag, that means i have no good way of organizing jars?
brad
A: 

Just stay with your two directories in your project folder, but join them, when creating your .war file. This should be pretty easy with apache ant and other build tools.

ZeissS
problem is i'm using maven to pull these in, both locally for devel and on deploy, so i'd like them to be contained in lib/java. of course i can have maven put them directly in lib, but that clogs my my devel environment by adding all these jars to a directory that I want to keep clean
brad
Shouldn't maven put them automatically directly in WEB-INF/lib/ when building the .war file?
ZeissS
ya i can have maven do that no problem. the problem comes when Rails wants to access them, as i'm telling it to look in lib/java. Doesn't work. For now I just have all the jars in lib and it works, it's just annoying when i'm developing on the rails side because I have about 20 jars that muddy up my ruby libs. It's purely cosmetic so it's not a huge deal but I was going for a bit of cleanup.
brad