简体   繁体   English

在MANIFEST.MF中具有不兼容类路径的Applet依赖JAR

[英]Applet dependency JARs with incompatible Class-Path in MANIFEST.MF

my applet depends on two JAR libraries. 我的小程序依赖于两个JAR库。 Each JAR library has a dependency on xercesImpl-2.2.1.jar. 每个JAR库都依赖于xercesImpl-2.2.1.jar。 Unfortunately they want this to have different names: 不幸的是,他们希望它具有不同的名称:

  • Apache FOP 0.20.5 Apache FOP 0.20.5

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl-2.2.1.jar... 在META-INF / MANIFEST.MF中的条目:类路径:xercesImpl-2.2.1.jar ...
  • Apache Xalan 2.4.1 Apache Xalan 2.4.1

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl.jar... 在META-INF / MANIFEST.MF中的条目:类路径:xercesImpl.jar ...

xercesImpl-2.2.1.jar is specified in the tag. 在标签中指定了xercesImpl-2.2.1.jar。 I can see in the Java console that it is downloaded successfully. 我可以在Java控制台中看到它已成功下载。 However later the console shows an attempt to read xercesImpl.jar which does not exist. 但是,稍后控制台显示尝试读取xercesImpl.jar的尝试,该尝试不存在。 It must be getting this from the Xalan manifest because the web application code does not specify xercesImpl.jar anywhere. 它必须从Xalan清单中获取,因为Web应用程序代码未在任何地方指定xercesImpl.jar。 Obviously it actually already has the contents of this JAR available so it doesn't actually need to load it. 显然,它实际上已经具有此JAR的内容,因此实际上不需要加载它。

I am using Maven to manage dependencies and would like to continue using these two standard public open source libraries without hacking their manifests. 我正在使用Maven来管理依赖项,并希望继续使用这两个标准的公共开源库,而不会破坏其清单。 Any suggestions for the best way to resolve this - or should I just live with the spurious error in the Java console? 关于解决此问题的最佳方法的任何建议-还是我应该忍受Java控制台中的虚假错误?

I'm not a Maven maven, but you're probably best off leaving the dependencies alone and somehow giving your project a 'goal' which involves re-packaging one of the JAR files once they are 'in' your project. 我不是Maven专家,但是您最好不要理the依赖关系,并且以某种方式为您的项目提供“目标”,这涉及到一个JAR文件“放入”项目后重新打包

Possibly one way to do it is to make 'repackaged JAR' artifact depends on the 'fop' artifact, and your project depends on the 'repackaged JAR' artifact. 可能的一种方法是使“重新包装的JAR”工件依赖于“ fop”工件,而您的项目依赖于“重新包装的JAR”工件。 Something like that. 这样的事情。

Here's my latest slightly hacky idea. 这是我最新的想法。 I have created valid empty JAR files with no classes in them and called them the names of the entries in the Class-Path, eg xercesImpl.jar . 我已经创建了没有类的有效空JAR文件,并将它们称为类路径中条目的名称,例如xercesImpl.jar。 I'm going to put them into src/main/webapp so they will be included in the right spot. 我将它们放入src / main / webapp中,以便将它们包含在正确的位置。 Java plugin will then happily download them instead of logging an error. 然后,Java插件将愉快地下载它们,而不是记录错误。

This way I only have to hack the web content (which is a mess anyway) rather than mess with the library JAR files, the Maven dependencies or the build process. 这样,我只需要破解Web内容(无论如何就是一团糟),而不必与库JAR文件,Maven依赖项或构建过程一团糟。

Still open to any better suggestions... 仍然欢迎任何更好的建议...

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

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