开发者

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

开发者 https://www.devze.com 2023-02-03 22:51 出处:网络
my applet depends on two JAR libraries.Each JAR library has a dependency on xercesImpl-2.2.1.jar.Unfortunately they want this to have different names:

my applet depends on two JAR libraries. Each JAR library has a dependency on xercesImpl-2.2.1.jar. Unfortunately they want this to have different names:

  • Apache FOP 0.20.5

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl-2.2.1.jar...
  • Apache Xalan 2.4.1

    • Entry in META-INF/MANIFEST.MF: Class-Path: xercesImpl.jar...

xercesImpl-2.2.1.jar is specified in the tag. I can see in the Java console that it is downloaded successfully. However later the console shows an attempt to read xercesImpl.jar which does not exist. It must be getting this from the Xalan manifest because the web application code does not specify xercesImpl.jar anywhere. Obviously it actually already has the contents of this JAR available so it doesn't actually need to load it.

I am using Maven to manage dependencies and would like to continue using these two standard public open source libraries without hacking their manifests. Any suggestions for the开发者_开发知识库 best way to resolve this - or should I just live with the spurious error in the Java console?


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.

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. 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, e.g xercesImpl.jar . I'm going to put them into src/main/webapp so they will be included in the right spot. Java plugin will then happily download them instead of logging an error.

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.

Still open to any better suggestions...

0

精彩评论

暂无评论...
验证码 换一张
取 消