简体   繁体   English

有没有一种方法可以将web-inf / lib类路径添加到耳朵中的独立jar中?

[英]Is there a way to add a web-inf/lib classpath to a standalone jar in an ear?

I have a fragile legacy application whose structure I do not want to change. 我有一个脆弱的旧应用程序,我不想更改其结构。 It is bundled as an EAR, with a few WAR applications and some supporting jars. 它作为EAR捆绑销售,具有一些WAR应用程序和一些支持罐。

I am introducing some Load Time Weaving AOP in which one Aspect has a dependency on a jar in the war/WEB-INF/lib folder. 我将介绍一些“加载时编织” AOP,其中一个方面依赖于war / WEB-INF / lib文件夹中的jar。

My AOP jar is in my EAR/lib folder. 我的AOP jar在我的EAR / lib文件夹中。

I don't want to move my webapp's jar to the ear/lib folder as this may cause other side effects with parent-first classloading. 我不想将我的Web应用程序的jar移到ear / lib文件夹,因为这可能会导致其他与父优先级类加载有关的副作用。

Is there any way to use the Manifest of my AOP jar and point to the lib in the War/WEB-INF folder? 有什么方法可以使用我的AOP jar的清单并指向War / WEB-INF文件夹中的lib? Is there a way to write the classpath as something like 有没有办法像这样写类路径

Class-Path: webapp.war/WEB-INF/lib/dependency.jar

or 要么

Class-Path: webapp.war:WEB-INF/lib/dependency.jar

No, that's not possible. 不,那不可能。 There might be hacks to work around this, but it generally doesn't look like a good design approach. 可能有一些解决方法,但是通常看起来它并不是一种好的设计方法。 You could try to extract the aspect which has a dependency on a lib in the war and move it to this war. 您可以尝试提取与战争中的lib相关的方面并将其移至这场战争。 Or to extract only the required functionality from dependency.jar. 或者仅从dependency.jar中提取所需的功能。 Hard to say, without more information. 很难说,没有更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM