java JBoss的不同lib目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/3064526/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Different lib directories of JBoss
提问by Serafeim
There is a number of different lib directories JBoss (5.1.0) uses: I can find jboss/lib, jboss/lib/endorsed, jboss/common/lib, jboss/server/default/lib and of course the jboss/server/default/deploy/myapp/WEB-INF/lib (am I missing something ?).
JBoss (5.1.0) 使用了许多不同的 lib 目录:我可以找到 jboss/lib、jboss/lib/endorsed、jboss/common/lib、jboss/server/default/lib,当然还有 jboss/server/ default/deploy/myapp/WEB-INF/lib(我错过了什么?)。
From the above, I know that I need to use the last one (WEB-INF/lib) to put any jars my app needs. What about all the others ? What is their use and what should I put there ? Why put it there and not in the WEB-INF/lib ?
从上面,我知道我需要使用最后一个(WEB-INF/lib)来放置我的应用程序需要的任何 jars。其他人呢?它们有什么用途,我应该在那里放什么?为什么把它放在那里而不是放在 WEB-INF/lib 中?
Thanks !
谢谢 !
回答by Georgy Bolyuba
Other folders are for different sorts of shared libs. For example, if you have 10 apps using same DB driver, there is really no reason to keep one db driver jar per application (i.e. 10 jars). In that case you can simply put it into jboss/server/<server config>/lib.
其他文件夹用于不同类型的共享库。例如,如果您有 10 个应用程序使用相同的数据库驱动程序,那么真的没有理由为每个应用程序保留一个数据库驱动程序 jar(即 10 个 jar)。在这种情况下,您可以简单地将其放入jboss/server/<server config>/lib.
jboss/server/<server config>/lib: all libs here are shared between all apps in given server configjboss/common/lib: shared between all server configsjboss/lib: these are libs for server itself (if I am not mistaking, they are also on your app classpath)jboss/lib/endorsed: this is the same as above, only if you put a lib here, it will always be found before similar lib in jboss/lib. The idea is similar to Endorsed Standards Override Mechanismof JDK
jboss/server/<server config>/lib:此处的所有库在给定服务器配置中的所有应用程序之间共享jboss/common/lib: 在所有服务器配置之间共享jboss/lib:这些是服务器本身的库(如果我没记错的话,它们也在您的应用程序类路径中)jboss/lib/endorsed: 这个和上面一样,只是你放了一个lib在这里,在jboss/lib中总会在类似的lib之前找到它。这个想法类似于JDK 的Endorsed Standards Override Mechanism

