[英]What is the correct way to package an enterprise application
Assume your application consists only of one war file.假设您的应用程序仅包含一个 war 文件。 My understanding is, that any third party library I need, and I am allowed to provide, I will include in my war, in WEB-INF/lib.我的理解是,我需要并且允许我提供的任何第三方库,我都会包含在我的战争中,在 WEB-INF/lib 中。
Today I came across someone who told me some details about JBoss 7 and their concept of modules, suggesting that an application should not deliver any third party library...but rather request the library in the correct version from the application server.今天我遇到有人告诉我一些关于 JBoss 7 及其模块概念的详细信息,建议应用程序不应交付任何第三方库......而是从应用程序服务器请求正确版本的库。
I am still more the type of guy who likes to deliver a full package, w/o any dependencies another user has to make sure, they are fullfilled.我仍然是那种喜欢提供完整的 package 的人,没有其他用户必须确保的任何依赖项,它们是完整的。 Now, long story short....is there a "Java EE standard" answer, how to cope with third party libraries in enterprise applications?'现在,长话短说......是否有“Java EE 标准”的答案,如何应对企业应用程序中的第三方库?
Per the Java EE 6 Tutorial :根据Java EE 6 教程:
The document root contains a subdirectory named WEB-INF, which can contain the following files and directories:文档根目录包含一个名为 WEB-INF 的子目录,其中可以包含以下文件和目录:
classes: A directory that contains server-side classes: servlets, enterprise bean class files, utility classes, and JavaBeans components classes:包含服务器端类的目录:servlets、企业 bean class 文件、实用程序类和 JavaBeans 组件
tags: A directory that contains tag files, which are implementations of tag libraries tags:包含标签文件的目录,标签文件是标签库的实现
lib: A directory that contains JAR files that contain enterprise beans, and JAR archives of libraries called by server-side classes lib:包含 JAR 文件的目录,其中包含企业 bean,以及由服务器端类调用的库的 JAR 档案
Deployment descriptors, such as web.xml (the web application deployment descriptor) and ejb-jar.xml (an EJB deployment descriptor) Deployment descriptors, such as web.xml (the web application deployment descriptor) and ejb-jar.xml (an EJB deployment descriptor)
So /WEB-INF/lib is correct.所以 /WEB-INF/lib 是正确的。
The "standard" answer depends on whether or not your Java EE app server supports the OSGi or JSR-277 standard. “标准”答案取决于您的 Java EE 应用服务器是否支持 OSGi 或JSR-277标准。
JBOSS version 7 does support OSGi; JBOSS 版本 7确实支持 OSGi; earlier versions might not.早期版本可能不会。
So it's really two answers: one for pre-OSGi servers ("put JARs in WEB-INF/lib for your app or the server /lib") and post-OSGi ("use OSGi").所以这实际上是两个答案:一个用于 pre-OSGi 服务器(“将 JARs 放入您的应用程序或服务器 /lib 的 WEB-INF/lib 中”)和 post-OSGi(“使用 OSGi”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.