在 EAR 的不同 WAR 中分离相同的 jar
目前我们面临一个问题。我们正在构建一个包含多个 war 文件的耳朵。其中 2 个 WAR 包含相同的 jar。这两个战争在部署期间都需要这些 jars。那么 ANT 有什么方法可以构建它,以便这些 jars 将位于一个位置,并且在耳朵部署期间不会产生任何问题。
currently we are facing one problem. We are building a ear which contains multiple war files. In 2 of the WARs contains same jars. Both these wars need these jars during deployment.So Is there any way in ANT I can built it so that these jars will be in one single place and it will not create any problem during the ear deployment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,您可以通过便携式方式做到这一点:
将库 jar 放在 .ear 文件的根目录中。
示例:
更新 .war 文件中的 MANIFEST.MF 文件以指向这些 jar
像这样:
类路径:lib1.jar lib2.jar
(如果这是清单中的最后一个条目,请不要忘记在上一行的末尾添加空格和换行符)
well, you can do it the portable way:
Place the library jars at the root of .ear file.
Example:
Update the MANIFEST.MF files in both the .war files to point to these jars
like so:
Class-Path: lib1.jar lib2.jar
(dont forget to add a space and a newline character to the end of the above line if this is the last entry in the manifest)
您可以将这些共享 JAR 放入 EAR 的
lib
目录中。然后,这些内容将在该 EAR 中的任何 WAR 的类路径上可用。You can put those shared JARs into the EAR's
lib
directory. Those will then be available on the classpath for any WARs in that EAR.