向Websphere的类路径添加资源或属性 [英] Add resources or property to Websphere's classpath
问题描述
我有一个问题和解决方案.但是我不喜欢我的解决方案,有人可以提供一种优雅的方式来解决这个问题吗?
I've a problem and a solution. But I don't like my solution, could someone provide an elegant way of solving this?
这用于在IDE中运行Web应用程序.我有一个EAR项目,正在使用RAD7.5.我的EAR项目看起来像
This is for running web application inside IDE. I've an EAR project and I'm using RAD7.5. My EAR project looks like
EAR_Project
部署描述符
模块
Jar1
Jar2
战争
Meta-Inf
application.xml
EAR_Project
Deployment Descriptor
Module
Jar1
Jar2
War
Meta-Inf
application.xml
我的问题是,Jar1和Jar2具有自己的库和属性文件.到目前为止,我将Jar1& Jar2的所有库和属性复制到War/Web-Inf中,并且工作正常.我是否对application.xml进行了配置更改,所以不必复制依赖的库和属性?非常感谢您的帮助
My question is, Jar1 and Jar2 has its own libraries and properties files. As of now, I copy all libraries and properties of Jar1&Jar2 into War/Web-Inf and it works fine. Is there a config change that i make to application.xml so that I don't have to copy dependent libraries and properties? Your help is much appreciated
推荐答案
在application.xml中,可能存在<library-directory>
元素,该元素指向EAR中共享库的位置.例如,对于EAR根目录中的目录lib
,在application.xml中应该有条目<library-directory>lib</library-directory>
:
In application.xml there can be <library-directory>
element that points to the location to shared libraries within EAR. For example, for directory lib
in the root of EAR there should be entry <library-directory>lib</library-directory>
in application.xml:
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
<module>
<java>module1.jar</java>
</module>
<module>
<web>
<web-uri>module2.war</web-uri>
<context-root>module2</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
这篇关于向Websphere的类路径添加资源或属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!