Question

I have some values that I need to appear in a MANIFEST.MF file to keep JAI happy with ImageIO.read.

Where do they need to exist to be available during the test phase of the maven cycle?

Was it helpful?

Solution 2

After an extensive search it seems this is impossible.

However, the issue should never arise because the JAI is inside a JAR and that JAR should contain the desired values. Consequently as suggested on a similar question I was indeed trying to compile the JAI. In my case because I am deploying one of my components as an executable to naive users I was using the shade plugin to build a "Fat JAR" which contained all the classes individually.

Unfortunately I have copied the pom.xml file that I had used to build this application into one of the class libraries that I reference and consequently this class library had become a "Fat JAR" too. This jar did not contain the values in the manifest even though it did reference the JAI libraries and consequently chaos ensued. The issue was compounded as that mistake was made many months ago and only now after an unrelated change had the version of JAI inside the particular Fat reference JAR come to be used by the JVM.

If you come across the same problem (as a search of the internet suggests others have) firstly try 2 things.

  1. Add the Specification-Vendor and Implementation-Vendor attributes to the manifest files of any jars you are building yourself.

  2. Build a simple application which just reads in any image file with ImageIO.read and then run this removing maven references one-by-one until the issue disappears and focus your efforts on this JAR.

OTHER TIPS

Wouldn't that be in the test resources

src/test/resources/META-INF/MANIFEST.MF
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top